Skip to content

Commit e251397

Browse files
authored
Merge pull request #374 from saloonphp/feature/v3-pretty-print-fixtures
Feature | V3 Pretty Print Fixtures & Cached Responses
2 parents 8dce746 + 52928bb commit e251397

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Data/RecordedResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function fromResponse(Response $response): static
7171
*/
7272
public function toFile(): string
7373
{
74-
return json_encode($this, JSON_THROW_ON_ERROR);
74+
return json_encode($this, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
7575
}
7676

7777
/**

tests/Unit/FixtureDataTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
],
5454
];
5555

56-
$fixtureData = RecordedResponse::fromFile(json_encode($data));
56+
$fixtureData = RecordedResponse::fromFile(json_encode($data, JSON_PRETTY_PRINT));
5757

58-
$serialized = json_encode($fixtureData);
58+
$serialized = json_encode($fixtureData, JSON_PRETTY_PRINT);
5959

60-
expect($serialized)->toEqual(json_encode($data));
60+
expect($serialized)->toEqual(json_encode($data, JSON_PRETTY_PRINT));
6161
expect($fixtureData->toFile())->toEqual($serialized);
6262
});

0 commit comments

Comments
 (0)