Skip to content

Commit bf9af3d

Browse files
authored
Merge pull request #166 from 27pchrisl/json-types
Support other types that can be valid JSON
2 parents 151a270 + d1ebc83 commit bf9af3d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/MatchesSnapshots.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function assertMatchesHtmlSnapshot(string $actual): void
8686
$this->assertMatchesSnapshot($actual, new HtmlDriver());
8787
}
8888

89-
public function assertMatchesJsonSnapshot(array|string $actual): void
89+
public function assertMatchesJsonSnapshot(array|string|null|int|float|bool $actual): void
9090
{
9191
$this->assertMatchesSnapshot($actual, new JsonDriver());
9292
}

tests/Unit/Drivers/JsonDriverTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ public function it_can_not_serialize_resources()
129129
* ["{}", "{\"data\":1}", false]
130130
* ["{\"data\":1}", "{\"data\":1}", true]
131131
* ["{\"data\":1}", "{\"data\":\"1\"}", false]
132+
* ["true", "true", true]
133+
* ["false", "false", true]
134+
* ["null", "null", true]
135+
* ["1", "1", true]
136+
* ["1.1", "1.1", true]
132137
*/
133138
public function it_can_match_json_strings(string $expected, string $actual, bool $assertion)
134139
{

0 commit comments

Comments
 (0)