Skip to content

Commit b086bc9

Browse files
authored
Merge pull request #71 from acbramley/v1
Fix JsonDriver for v1
2 parents 806539f + 43404db commit b086bc9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Drivers/JsonDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function extension(): string
2929
public function match($expected, $actual)
3030
{
3131
if (is_array($actual)) {
32-
$actual = json_encode($data, JSON_PRETTY_PRINT).PHP_EOL;
32+
$actual = json_encode($actual, JSON_PRETTY_PRINT).PHP_EOL;
3333
}
3434

3535
Assert::assertJsonStringEqualsJsonString($expected, $actual);

tests/Integration/AssertionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public function can_match_a_json_snapshot()
4141
$this->assertMatchesJsonSnapshot($data);
4242
}
4343

44+
/** @test */
45+
public function can_match_an_array_snapshot()
46+
{
47+
$data = ['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'];
48+
49+
$this->assertMatchesJsonSnapshot($data);
50+
}
51+
4452
/** @test */
4553
public function can_match_a_file_hash_snapshot()
4654
{

0 commit comments

Comments
 (0)