You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.
I'm storing postal codes as string (because it's a recommended way), when I store a postal code like 44000 in my API, it's stored as a string and data is rendered as postalCode: "44000" in the JSON produced by the API.
I have the following Behat step:
And the JSON node "postalCode" should be equal to the string "44000"
This test fails because the expected value 44000 is casted to an integer by PHP in theJsonNodeShouldBeEqualToTheString. Calls to var_dump() show that the actual text is string(5) "44000" but the expected text is int(44000).. So the expression ($actual !== $text) fails and the test fail.
I can use the following step in order to remove variable type check:
And the JSON node "postalCode" should be equal to "44000"
But I'm still wondering how theJsonNodeShouldBeEqualToTheString should work when a string is seen by PHP as an integer. Should expected value be cast to strings?
The text was updated successfully, but these errors were encountered:
I'm storing postal codes as string (because it's a recommended way), when I store a postal code like
44000
in my API, it's stored as a string and data is rendered aspostalCode: "44000"
in the JSON produced by the API.I have the following Behat step:
This test fails because the expected value
44000
is casted to an integer by PHP intheJsonNodeShouldBeEqualToTheString
. Calls tovar_dump()
show that the actual text isstring(5) "44000"
but the expected text isint(44000).
. So the expression($actual !== $text)
fails and the test fail.I can use the following step in order to remove variable type check:
But I'm still wondering how
theJsonNodeShouldBeEqualToTheString
should work when a string is seen by PHP as an integer. Should expected value be cast to strings?The text was updated successfully, but these errors were encountered: