Skip to content

Testing: Add PHPUnit tests for field group functions#316

Closed
priethor wants to merge 1 commit intotrunkfrom
f0c6-phase-1-pr-3-fie
Closed

Testing: Add PHPUnit tests for field group functions#316
priethor wants to merge 1 commit intotrunkfrom
f0c6-phase-1-pr-3-fie

Conversation

@priethor
Copy link
Copy Markdown
Contributor

@priethor priethor commented Dec 29, 2025

What

Part of #283.

Adds PHPUnit test coverage for SCF field group functions.

Why

Field groups are the core organizational unit in SCF. These functions handle CRUD operations, visibility rules, duplication, and import/export.

How

With the help of Claude, adding 66 tests covering:

  • Field group key validation
  • Field group validation and defaults
  • CRUD operations (get, update, delete, trash, untrash)
  • Collection operations and filtering
  • Visibility and location rule matching
  • Field group duplication
  • Active status management
  • Style generation for hide_on_screen
  • Import/export functionality
  • Settings tabs configuration
  • Cache and slug filter functions

Testing Instructions

Run the test suite: ./vendor/bin/phpunit --filter Test_ACF_Field_Group_Functions

Add 66 tests covering field group CRUD operations, validation,
visibility, duplication, import/export, and utility functions.

Test coverage includes:
- Field group key validation (acf_is_field_group_key)
- Field group validation (acf_validate_field_group)
- CRUD operations (get, update, delete, trash, untrash)
- Collection operations (get_field_groups, filter_field_groups)
- Visibility and location rules (acf_get_field_group_visibility)
- Duplication (acf_duplicate_field_group)
- Active status management
- Style generation for hide_on_screen
- Import/export functions
- Settings tabs configuration
- Cache and slug filter functions

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 14.17%. Comparing base (ab02e04) to head (2b87917).

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #316      +/-   ##
============================================
+ Coverage     13.55%   14.17%   +0.61%     
  Complexity     4404     4404              
============================================
  Files           291      291              
  Lines         36984    36984              
============================================
+ Hits           5014     5241     +227     
+ Misses        31970    31743     -227     
Flag Coverage Δ
e2e 28.87% <ø> (ø)
javascript 2.50% <ø> (ø)
phpunit 11.43% <ø> (+0.84%) ⬆️

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.

@github-actions
Copy link
Copy Markdown

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.

@priethor priethor changed the title Tests: Add comprehensive tests for acf-field-group-functions.php Testing: Add PHPUnit tests for field group functions Dec 29, 2025
@priethor priethor closed this Dec 29, 2025
@priethor priethor deleted the f0c6-phase-1-pr-3-fie branch December 29, 2025 19:06
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