Skip to content
Snippets Groups Projects
Commit 08e2d254 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

remove camspiers/json-pretty and indent json in jsonapi tests using a regex, fixes #2470

Closes #2470

Merge request studip/studip!1666
parent f466ba75
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
}, },
"require-dev": { "require-dev": {
"adlawson/vfs": "~0.12.1", "adlawson/vfs": "~0.12.1",
"camspiers/json-pretty": "~1.0.2",
"php-http/curl-client": "~1.7.0", "php-http/curl-client": "~1.7.0",
"woohoolabs/yang": "2.3.2", "woohoolabs/yang": "2.3.2",
"codeception/codeception": "^4.2", "codeception/codeception": "^4.2",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4b87251e3dbe4f1e9674d2cab3ebfe02", "content-hash": "4b5b02516381975e2210afd87a34a165",
"packages": [ "packages": [
{ {
"name": "algo26-matthias/idna-convert", "name": "algo26-matthias/idna-convert",
...@@ -4402,47 +4402,6 @@ ...@@ -4402,47 +4402,6 @@
}, },
"time": "2021-10-12T13:05:09+00:00" "time": "2021-10-12T13:05:09+00:00"
}, },
{
"name": "camspiers/json-pretty",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/camspiers/json-pretty.git",
"reference": "17be37cb83af8014658da48fa0012604179039a7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/camspiers/json-pretty/zipball/17be37cb83af8014658da48fa0012604179039a7",
"reference": "17be37cb83af8014658da48fa0012604179039a7",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Camspiers": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Cam Spiers",
"email": "cameron@heyday.co.nz"
}
],
"description": "Provides support for json pretty printing",
"support": {
"issues": "https://github.com/camspiers/json-pretty/issues",
"source": "https://github.com/camspiers/json-pretty/tree/master"
},
"abandoned": true,
"time": "2016-02-06T01:25:58+00:00"
},
{ {
"name": "clue/stream-filter", "name": "clue/stream-filter",
"version": "v1.6.0", "version": "v1.6.0",
......
...@@ -203,8 +203,12 @@ class Jsonapi extends \Codeception\Module ...@@ -203,8 +203,12 @@ class Jsonapi extends \Codeception\Module
} }
} }
$jsonPretty = new \Camspiers\JsonPretty\JsonPretty(); $json = json_encode($jsonBody, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
$json = $jsonPretty->prettify($jsonBody, 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/'; $dirname = codecept_output_dir() . 'json-for-slate/';
if (!file_exists($dirname)) { if (!file_exists($dirname)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment