Codeception / module-rest

REST module for Codeception
MIT License
53 stars 27 forks source link

Xpath compatibility #87

Closed pamoller closed 2 years ago

pamoller commented 2 years ago

Transforming JSON documents to XML document to use with XPath causes a loss of information, cause the string operator translates true and null to ''

 $subNode->nodeValue = htmlspecialchars((string)$value);

So boolean values can't be found by an expression like:

$I->seeResponseJsonXpathEvaluatesTo("//boolean[text() = 'true']");

Using a more elaborated transformation, https://tqdev.com/2017-converting-json-to-xml-in-javascript-and-php, keeps all informations:

{"boolean":true, "number": -1.2780E+2, "null": null, "string": "i'am a sentence"}

transforms to now

<root>
   <boolean type="boolean">true</boolean>
   <number type ="number">-127.8</number>
   <null type="null"></null>
   <string type="string">i'am a sentence</string>
</root>

so see now: JsonArrayTest.php

Naktibalda commented 2 years ago

Please rebase your branch on master branch of this repository.

Naktibalda commented 2 years ago

It seems that you forgot to fetch

pamoller commented 2 years ago

So everything ok, wright now?

Naktibalda commented 2 years ago

16 commits is not ok, it shows commits from your previous pull request. It would probably be better start a new branch based on master (or git reset --hard) and cherry-pick commits from this branch,

pamoller commented 2 years ago

I created an new pull request, hopes that fit the needs :)