Skip to content

Commit d7bc121

Browse files
authored
Control Char check Test Case
1 parent cc03d34 commit d7bc121

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/system/EntityTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,20 @@ public function testCastAsJSONAnotherErrorDepth()
490490

491491
$method($string, true);
492492
}
493+
494+
public function testCastAsJSONControlCharCheck()
495+
{
496+
$entity = new Entity();
497+
498+
$method = $this->getPrivateMethodInvoker($entity,'castAsJson');
499+
500+
$this->expectException(CastException::class);
501+
$this->expectExceptionMessage('Unexpected control character found');
502+
503+
$string = "{\n\t\"property1\": \"The quick brown fox\njumps over the lazy dog\",\n\t\"property2\":\"value2\"\n}";
504+
505+
$method($string, true);
506+
}
493507
//--------------------------------------------------------------------
494508

495509
public function testAsArray()

0 commit comments

Comments
 (0)