Skip to content

Commit

Permalink
Update JsonTest.php
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
  • Loading branch information
ghostwriter committed May 2, 2023
1 parent 8e40835 commit 7ffdb87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/Unit/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,24 @@ public function testItPrettyPrints(): void
public function testThrowsOnControlCharacterError(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionCode(3);
$this->expectExceptionMessage('Control character error, possibly incorrectly encoded');
Json::decode("\0");
}

public function testThrowsOnMalformedUtf8Characters(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionCode(5);
$this->expectExceptionMessage('Malformed UTF-8 characters, possibly incorrectly encoded');
Json::encode(["bad utf\xFF"]);
}

public function testThrowsOnSyntaxError(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionCode(4);
$this->expectExceptionMessage('Syntax error');
Json::decode('{');
}
}

0 comments on commit 7ffdb87

Please sign in to comment.