new: [test] JSONConverterToolTest

pull/8229/head
Jakub Onderka 2022-03-26 13:17:19 +01:00
parent 6af7503b36
commit 5b65286f51
1 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,12 @@ class JSONConverterToolTest extends TestCase
foreach (JSONConverterTool::streamConvert($event) as $part) {
$json .= $part;
}
// This check is important for protected events
$jsonStreamWithoutSpaces = preg_replace("/\s+/", "", $json);
$jsonNormalWithoutSpaces = preg_replace("/\s+/", "", JSONConverterTool::convert($event));
$this->assertEquals($jsonNormalWithoutSpaces, $jsonStreamWithoutSpaces);
if (defined('JSON_THROW_ON_ERROR')) {
json_decode($json, true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(true);