diff --git a/src/NextcloudApiContext.php b/src/NextcloudApiContext.php index 379c96a..a34df02 100644 --- a/src/NextcloudApiContext.php +++ b/src/NextcloudApiContext.php @@ -265,11 +265,11 @@ private function jsonStringMatchWith(string $json, array $expectedValues): void $this->validateAsJsonQuery($expected, $actual); continue; } - if ($this->isJson($actual)) { - Assert::assertJsonStringEqualsJsonString($value['value'], $actual, 'Key: ' . $value['key']); + if ($this->isJson($actual) && $this->isJson($value['value'])) { + Assert::assertJsonStringEqualsJsonString($value['value'], $actual, 'Key: ' . $value['key'] . ' JSON: ' . $json); continue; } - Assert::assertEquals($value['value'], $actual, 'Key: ' . $value['key']); + Assert::assertEquals($value['value'], $actual, 'Key: ' . $value['key'] . ' JSON: ' . $json); } }