Can't make array Repeat expander working in JSON context
JarJak opened this issue · 0 comments
JarJak commented
Or maybe I am using it wrong way?
First I've tried:
"@array@.repeat({"name": "@string@", "value": "@array@"})"
Which gives confusing error: RuntimeException: Type pattern "@array@" is not supported by TextMatcher.
Then I've tried:
"@array@.repeat({\"name\": \"@string@\", \"value\": \"@array@\"})"
But that one also gives an error:
Behat\Testwork\Call\Exception\FatalThrowableError: Type error: Argument 1 passed to Coduo\PHPMatcher\Matcher\Pattern\Expander\Repeat::__construct() must be of the type string, array given in vendor/coduo/php-matcher/src/Matcher/Pattern/Expander/Repeat.php:29
Stack trace:
#0 [internal function]: Coduo\PHPMatcher\Matcher\Pattern\Expander\Repeat->__construct(Array)
#1 vendor/coduo/php-matcher/src/Parser/ExpanderInitializer.php(79): ReflectionClass->newInstanceArgs(Array)
Repeat matcher expects argument to be json encoded string but ExpanderInitializer gives to it already decoded json array. It can be fixed by allowing Repeat expander to accept arrays too.