Skip to content

Add unit tests for filters#20774

Open
WarLikeLaux wants to merge 2 commits intoyiisoft:masterfrom
WarLikeLaux:test-filters
Open

Add unit tests for filters#20774
WarLikeLaux wants to merge 2 commits intoyiisoft:masterfrom
WarLikeLaux:test-filters

Conversation

@WarLikeLaux
Copy link
Contributor

Q A
Is bugfix?
New feature?
Breaks BC?
Fixed issues

What does this PR do?

Add unit tests for AccessControl orchestration, VerbFilter, and AccessRule::matchCallback.

Before / After

File Tests Methods Lines MSI
AccessControl.php 0 → 14 0/3 → 3/3 0/25 (0%) → 25/25 (100%) — → 93% (27/29)
VerbFilter.php 0 → 13 0/2 → 1/2 0/14 (0%) → 13/14 (93%) — → 92% (12/13)
AccessRule.php 31 → 35 7/7 49/49 (100%) — → 89% (92/103)

VerbFilter line 87 (events() method) is covered only through behavior attachment, not direct beforeAction() calls.

Escaped mutants (all equivalent)

AccessControl.php (2): MethodCallRemoval - L104, parent::init() removal. ProtectedVisibility - L154, visibility change.

VerbFilter.php (1): ConcatOperandRemoval - L112, exception message text.

AccessRule.php (11): ProtectedVisibility ×6 - L192, L201, L222, L264, L294, L303, always equivalent. ReturnRemoval ×3 - L214, L257, L287, return false → implicit null, falsy either way in boolean && chain inside allows(). UnwrapArrayMerge - L227, array_merge → direct assign not caught because can() mock returns same value for all items. LogicalAnd - L249, &&|| in roleParams callable check produces same result for all tested input types (arrays, closures, callable objects).

Changelog not required, because no source files changed.

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.24%. Comparing base (37b6e7b) to head (528d62c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #20774      +/-   ##
============================================
+ Coverage     80.13%   80.24%   +0.10%     
  Complexity    11533    11533              
============================================
  Files           374      374              
  Lines         30206    30206              
============================================
+ Hits          24207    24238      +31     
+ Misses         5999     5968      -31     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant