Skip to content

Commit 0fe4977

Browse files
authored
Merge pull request #34 from elbformat/array_support
Allow array json values in AbstractDatabaseContext
2 parents 2095f79 + 13c4aaf commit 0fe4977

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

doc/changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## v1.5.7
4+
* Feature/Fix: Support json arrays in AbstractDatabaseContext
5+
36
## v1.5.6
47
* Feature: Testing with command inputs
58

src/Context/AbstractDatabaseContext.php

+4
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ protected function convertAssertionValue(string $value, ?string $type): mixed
240240
}
241241

242242
return match ($type) {
243+
'array' => json_decode($value, false, 512, JSON_THROW_ON_ERROR),
243244
'bool' => 'false' !== $value && '0' !== $value,
244245
'DateTimeInterface', 'DateTime' => new \DateTime($value),
245246
'DateTimeImmutable' => new \DateTimeImmutable($value),
@@ -268,6 +269,9 @@ protected function printAlternatives(array $data): string
268269
case 'bool' === $type:
269270
$realVal = $realVal ? 'true' : 'false';
270271
break;
272+
case 'array' === $type:
273+
$realVal = json_encode($realVal);
274+
break;
271275
case $realVal instanceof \DateTimeInterface:
272276
$realVal = $realVal->format('c');
273277
break;

0 commit comments

Comments
 (0)