Skip to content

Conversation

@priethor
Copy link
Contributor

@priethor priethor commented Dec 30, 2025

What

Part of #315.

Adds PHPUnit test coverage for all 23 location rule classes that determine when and where field groups appear in the WordPress admin.

Why

Location rules are critical for controlling field group visibility. They handle complex matching logic including:

  • Post type, status, format, template, and taxonomy matching
  • Page hierarchy (parent/type) and template matching
  • User role and form context matching
  • Widget, menu, options page, and block matching

How

Adding 139 tests across all location types:

  • Base ACF_Location class methods (compare_to_rule, get_operators)
  • Post-based locations (post_type, post, post_status, post_format, post_template, post_taxonomy, post_category)
  • Page locations (page, page_parent, page_type, page_template delegation)
  • User locations (user_role, user_form, current_user, current_user_role)
  • Form/other locations (taxonomy, attachment, comment, nav_menu, nav_menu_item, widget, options_page, block)
  • Location type registration and retrieval functions

Testing Instructions

Run the test suite:

./vendor/bin/phpunit --filter Test_Location_Rules

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.78%. Comparing base (402b2cc) to head (fbd2c5a).
⚠️ Report is 2 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #329      +/-   ##
============================================
+ Coverage     21.19%   21.78%   +0.59%     
  Complexity     4410     4410              
============================================
  Files           291      291              
  Lines         36940    36940              
============================================
+ Hits           7828     8047     +219     
+ Misses        29112    28893     -219     
Flag Coverage Δ
e2e 28.87% <ø> (ø)
javascript 2.50% <ø> (ø)
phpunit 21.87% <ø> (+0.81%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@priethor priethor force-pushed the 0661-phase-2-pr-12-lo branch from ffae7d6 to bf31c9d Compare December 30, 2025 13:07
@priethor priethor mentioned this pull request Dec 30, 2025
22 tasks
@priethor priethor force-pushed the 0661-phase-2-pr-12-lo branch from bf31c9d to c17fd7b Compare December 30, 2025 13:10
Add comprehensive test coverage for all 26 location rule classes with
151 tests covering rule matching logic, operator handling, and value
resolution.
@priethor priethor force-pushed the 0661-phase-2-pr-12-lo branch from c17fd7b to fbd2c5a Compare December 30, 2025 13:22
@priethor priethor self-assigned this Dec 30, 2025
@priethor priethor added this to the 6.9.0 milestone Dec 30, 2025
@priethor priethor merged commit fba4d95 into trunk Dec 30, 2025
10 checks passed
@priethor priethor deleted the 0661-phase-2-pr-12-lo branch December 30, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants