Skip to content

Can't make array Repeat expander working in JSON context #150

@JarJak

Description

@JarJak

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions