Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON matcher is not working as expected with pattern expanders #90

Closed
norberttech opened this issue Oct 20, 2016 · 1 comment
Closed
Labels

Comments

@norberttech
Copy link
Member

In project I'm currently working on, we had a following scenario step:

    And json response should match:
    """
    {
      "limit": 10,
      "offset": 0,
      "count": 1,
      "wins": @[email protected](1)
    }
    """

and it was throwing me a very weird error: Type pattern "@array@" is not supported by TextMatcher. (RuntimeException).
After investigation it turned out that php-matcher/src/Matcher/Pattern/Assert/Json.php:33 can't recognize this pattern as a valid json value (because of @[email protected](1)) and thats why JSONExpander is being ignored.
The same problem seems to be found here: #83

Perfect solution would be to update Json::transformPattern($pattern) method, to transform patterns with expanders into native strings:

before transformation:
@[email protected](1)

after transformation:
"@[email protected](1)"

Of course currently this issue can be solved by making sure that all patterns with expanders are stored just like in following example:

    And json response should match:
    """
    {
      "limit": 10,
      "offset": 0,
      "count": 1,
      "wins": "@[email protected](1)"
    }
    """
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants