Skip to content

Commit

Permalink
escaped XML text content with htmlspecialschars Codeception#2775
Browse files Browse the repository at this point in the history
  • Loading branch information
Naktibalda committed Feb 8, 2016
1 parent 4dec9be commit fafa6f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Codeception/Util/JsonArray.php
Expand Up @@ -211,7 +211,7 @@ private function arrayToXml(\DOMDocument $doc, \DOMNode $node, $array)
if (is_array($value)) {
$this->arrayToXml($doc, $subNode, $value);
} else {
$subNode->nodeValue = (string)$value;
$subNode->nodeValue = htmlspecialchars((string)$value);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/Codeception/Module/RestTest.php
Expand Up @@ -241,6 +241,16 @@ public function testArrayJsonPathAndXPath()
$this->module->dontSeeResponseJsonMatchesJsonPath('$[*].profile');
}

/**
* @Issue https://github.com/Codeception/Codeception/issues/2775
*/
public function testSeeResponseJsonMatchesXPathWorksWithAmpersand()
{
$this->setStubResponse('{ "product":[ { "category":[ { "comment":"something & something" } ] } ] }');
$this->module->seeResponseIsJson();
$this->module->seeResponseJsonMatchesXpath('//comment');
}


public function testArrayJsonPathFails()
{
Expand Down

0 comments on commit fafa6f6

Please sign in to comment.