diff --git a/CHANGELOG.md b/CHANGELOG.md index df25458..6ccbbf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to `phpunit-snapshot-assertions` will be documented in this file +## 1.4.2 - 2019年05月13日 +- Fix JSON driver + ## 1.4.1 - 2019年01月29日 - Fix JSON array comparisons diff --git a/src/Drivers/JsonDriver.php b/src/Drivers/JsonDriver.php index 253bdd6..41e22cd 100644 --- a/src/Drivers/JsonDriver.php +++ b/src/Drivers/JsonDriver.php @@ -29,7 +29,7 @@ public function extension(): string public function match($expected, $actual) { if (is_array($actual)) { - $actual = json_encode($data, JSON_PRETTY_PRINT).PHP_EOL; + $actual = json_encode($actual, JSON_PRETTY_PRINT).PHP_EOL; } Assert::assertJsonStringEqualsJsonString($expected, $actual); diff --git a/tests/Integration/AssertionTest.php b/tests/Integration/AssertionTest.php index 0367050..6f6513b 100644 --- a/tests/Integration/AssertionTest.php +++ b/tests/Integration/AssertionTest.php @@ -41,6 +41,14 @@ public function can_match_a_json_snapshot() $this->assertMatchesJsonSnapshot($data); } + /** @test */ + public function can_match_an_array_snapshot() + { + $data = ['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']; + + $this->assertMatchesJsonSnapshot($data); + } + /** @test */ public function can_match_a_file_hash_snapshot() {

AltStyle によって変換されたページ (->オリジナル) /