Skip to content

Commit

Permalink
Merge pull request #374 from saloonphp/feature/v3-pretty-print-fixtures
Browse files Browse the repository at this point in the history
Feature | V3 Pretty Print Fixtures & Cached Responses
  • Loading branch information
Sammyjo20 authored Feb 14, 2024
2 parents 8dce746 + 52928bb commit e251397
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Data/RecordedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/FixtureDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

0 comments on commit e251397

Please sign in to comment.