[5.6] Allow asserting an integer with assertSee() #23892
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When trying to assert a number (example: id, downloads count ...) is seen or not seen on the page with any of these methods
assertSee()
assertDontSee()
assertSeeText()
assertDontSeeText()
a phpunit exception will be raised, because the haystack (response content) is a string and the needle (what i'm asserting to be seen) is an integer (not a string)
Check the phpunit source code for that
https://github.com/sebastianbergmann/phpunit/blob/c1b35f210334bf1695af4fe6a16c3a72ebbe5e3d/src/Framework/Assert.php#L196
For example this assertion
Will raise this exception
This PR tries to solve that by casting the $value to a string