Fix imprecise %s placeholders in phpt test expectations#22065
Conversation
|
This is not quite inadvertent, but it's sort of pointless to test the very same thing thousands of times instead just a hundred times. It's not quite the point of the tests to test the formatting of the error string. There are enough tests in Zend/ which test error string formatting. |
22e88c1 to
9dc95c4
Compare
|
It's not testing the formatting of the error string, but asserting the exact error message instead. The placeholder is used to hide the file path and line number (I'm not a fan of this approach, but it's a convention in php-src, so it was included), as advised in the documentation:
If those assertions are pointless, then where is the boundary for such assertions? What part of the error message should we test and what shouldn't we? In which directories should there be a full error message, and in which should there be a wider placeholder? I think answering those questions is more difficult than applying the same standard to all tests. |
|
We want to test the error message. For warnings, notices and deprecations, it's the part before "in ...". For errors and exceptions, it's the value of |
In
--EXPECTF--sections,%splaceholders were being used to match more than just file paths, inadvertently absorbing line number information and making the assertions weaker than intended.