diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2023-03-28 09:16:10 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2023-03-28 09:16:10 +0200 |
| commit | d37d28adb8a776ba699cc11a80a18a5d25f3f11b (patch) | |
| tree | 6f141d29af2341d72b91aab53ff4ccfa649b3c6f /tests | |
| parent | 08e2d254385c36a28d4b1db21434b9022005597d (diff) | |
simplify indentation shortener via regexp, re #2470
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/_support/Helper/Jsonapi.php | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/tests/_support/Helper/Jsonapi.php b/tests/_support/Helper/Jsonapi.php index 93750d9..81d112c 100644 --- a/tests/_support/Helper/Jsonapi.php +++ b/tests/_support/Helper/Jsonapi.php @@ -206,9 +206,7 @@ class Jsonapi extends \Codeception\Module $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); + $json = preg_replace('/^( +)\1/m', '$1', $json); $dirname = codecept_output_dir() . 'json-for-slate/'; if (!file_exists($dirname)) { |
