Skip to content

fix: Emit deprecation if filter string does not contain @ prefixes #417

Open
acoulton wants to merge 5 commits intoBehat:masterfrom
acoulton:deprecate-unprefixed-tag-filter
Open

fix: Emit deprecation if filter string does not contain @ prefixes #417
acoulton wants to merge 5 commits intoBehat:masterfrom
acoulton:deprecate-unprefixed-tag-filter

Conversation

@acoulton
Copy link
Copy Markdown
Contributor

This PR builds on #416 - only e70deb9 is new in this branch.

When we added the BC layer to reintroduce support for filter strings without @ prefixes, we didn't add a runtime deprecation because Behat didn't have a way to capture and report these.

However, since Behat does now have a deprecation collector / reporter (which does not fail the build by default) we can now safely emit the deprecation.

Fixes #408

The verbosity of the existing tests make it slightly hard to see exactly
what syntax is and is not covered by tests. Particularly because there
is some duplication between the examples for features and scenarios.

It will become even more difficult when we add more examples for syntax
that is not currently covered.

Therefore, refactor to use a single test method with data providers for
the expected matching / not matching cases.

This commit only refactors the cases that were already tested.
These cases were not fully covered by existing tests, and help to
clarify the expected behaviour of the filter.
Refactor the existing test to cover more cases, in particular the
interaction between deprecation and matching and the interaction with
the separate `testTagFilterThatIsAllWhitespaceIsIgnored` which was not
actually testing any strings with whitespace.
Whitespace is allowed within a tag filter expression either side of the
`&&` or `,` operators.

This reinstates historical behaviour where these strings were allowed.

The deprecation on filters containing whitespace is now only triggered
if the tags themselves contain whitespace, after trimming any space
around operators.
When we added the BC layer to reintroduce support for filter strings
without `@` prefixes, we didn't add a runtime deprecation because Behat
didn't have a way to capture and report these.

However, since Behat does now have a deprecation collector / reporter
(which does not fail the build by default) we can now safely emit the
deprecation.
@acoulton acoulton requested a review from stof April 22, 2026 09:46
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.79%. Comparing base (24ef151) to head (e70deb9).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #417      +/-   ##
============================================
+ Coverage     95.71%   95.79%   +0.07%     
- Complexity      685      689       +4     
============================================
  Files            45       45              
  Lines          2031     2117      +86     
============================================
+ Hits           1944     2028      +84     
- Misses           87       89       +2     
Flag Coverage Δ
php8.1 95.79% <100.00%> (+0.07%) ⬆️
php8.1--with=symfony/yaml:^5.4 95.79% <100.00%> (+0.07%) ⬆️
php8.1--with=symfony/yaml:^6.4 95.79% <100.00%> (+0.07%) ⬆️
php8.2 95.79% <100.00%> (+0.07%) ⬆️
php8.3 95.79% <100.00%> (+0.07%) ⬆️
php8.4 95.79% <100.00%> (+0.07%) ⬆️
php8.5 95.79% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BC break] Drop support for tag filter expressions without @ prefixes

1 participant