Stabilize regex error Behat assertions across PHP/PCRE versions#239
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@copilot the modification helps make some tests pass, but they still fail on php 7.2: The assertion could use regex, e.g. |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
... Addressed in ad8e0e0. I switched the four invalid-regex checks to |
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the Behat coverage around invalid-regex handling for wp search-replace by removing reliance on a PCRE-reported byte offset that can vary across PHP/PCRE versions.
Changes:
- Replaced four brittle
STDERR should containassertions (hard-codedat offset 11) with a regex-based assertion that accepts any numeric offset while still validating the underlying compilation failure. - Kept the scenario focused on the specific failure mode (“unmatched closing parenthesis…”) while avoiding false negatives across environments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The failing
test / Behat (8.3, trunk, mysql-8.0)job was caused by a brittle Behat expectation for invalid regex errors. The command output remained correct, but the asserted PCRE offset changed in newer PHP/PCRE builds.Problem
features/search-replace.featurehard-codedat offset 11.unmatched closing parenthesis at offset 12.Change
Result