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

seeResponseJsonMatchesXpath fails if JSON contains ampersand #2775

Closed
radnov opened this issue Feb 8, 2016 · 1 comment
Closed

seeResponseJsonMatchesXpath fails if JSON contains ampersand #2775

radnov opened this issue Feb 8, 2016 · 1 comment
Labels

Comments

@radnov
Copy link

@radnov radnov commented Feb 8, 2016

Trying to match JSON with "xpath" (jsonpath?) via seeResponseJsonMatchesXpath fails if the asserted JSON contains an element with ampersand in it.

JSON example:
{ "product":[ { "category":[ { "comment":"something & something" } ] } ] }

Error:
[PHPUnit_Framework_Exception] Codeception\Util\JsonArray::arrayToXml(): unterminated entity reference something

@Naktibalda Naktibalda added the REST label Feb 8, 2016
@javigomez
Copy link
Contributor

@javigomez javigomez commented Feb 8, 2016

@gunfrank I had issues with seeResponseJsonMatchesXpath instead it ended up being much more easier using arrays. Try:

$I->seeResponseContainsJson(
            [
                 'product'            => [ "category" => [ "comment" => "something & something" ]
            ]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.