diff --git a/src/Data/RecordedResponse.php b/src/Data/RecordedResponse.php index 511027e0..0c524cd1 100644 --- a/src/Data/RecordedResponse.php +++ b/src/Data/RecordedResponse.php @@ -71,7 +71,7 @@ public static function fromResponse(Response $response): static */ public function toFile(): string { - return json_encode($this, JSON_THROW_ON_ERROR); + return json_encode($this, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT); } /** diff --git a/tests/Unit/FixtureDataTest.php b/tests/Unit/FixtureDataTest.php index f84238c5..c2ed998e 100644 --- a/tests/Unit/FixtureDataTest.php +++ b/tests/Unit/FixtureDataTest.php @@ -53,10 +53,10 @@ ], ]; - $fixtureData = RecordedResponse::fromFile(json_encode($data)); + $fixtureData = RecordedResponse::fromFile(json_encode($data, JSON_PRETTY_PRINT)); - $serialized = json_encode($fixtureData); + $serialized = json_encode($fixtureData, JSON_PRETTY_PRINT); - expect($serialized)->toEqual(json_encode($data)); + expect($serialized)->toEqual(json_encode($data, JSON_PRETTY_PRINT)); expect($fixtureData->toFile())->toEqual($serialized); });