seeResponseJsonMatchesXpath fails if JSON contains ampersand #2775

Closed
gunfrank opened this Issue Feb 8, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@gunfrank

gunfrank 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

This comment has been minimized.

Show comment
Hide comment
@javigomez

javigomez Feb 8, 2016

Contributor

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

$I->seeResponseContainsJson(
            [
                 'product'            => [ "category" => [ "comment" => "something & something" ]
            ]
);
Contributor

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