diff options
Diffstat (limited to 'tests/_support/Helper/Jsonapi.php')
| -rw-r--r-- | tests/_support/Helper/Jsonapi.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/_support/Helper/Jsonapi.php b/tests/_support/Helper/Jsonapi.php index e435cad..93750d9 100644 --- a/tests/_support/Helper/Jsonapi.php +++ b/tests/_support/Helper/Jsonapi.php @@ -203,8 +203,12 @@ class Jsonapi extends \Codeception\Module } } - $jsonPretty = new \Camspiers\JsonPretty\JsonPretty(); - $json = $jsonPretty->prettify($jsonBody, JSON_UNESCAPED_SLASHES, ' '); + $json = json_encode($jsonBody, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + + // This converts the default indentation of 4 spaces to 2 spaces + $json = preg_replace_callback('/^( +)(?=\S)/m', function ($match) { + return str_pad('', strlen($match[1]) / 2, ' '); + }, $json); $dirname = codecept_output_dir() . 'json-for-slate/'; if (!file_exists($dirname)) { |
