Skip to content

PHPUnit CI: add WP trunk to the matrix, fix test_front_head for it - #3362

Closed
vivi-the-going-merry[bot] wants to merge 3 commits into
masterfrom
fix/issue-6676-phpunit-trunk-matrix
Closed

vivi-the-going-merry[bot] wants to merge 3 commits into
masterfrom
fix/issue-6676-phpunit-trunk-matrix

Conversation

@vivi-the-going-merry

@vivi-the-going-merry vivi-the-going-merry Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

What was broken

.github/workflows/phpunit.yml only tested against WP 6.9. Running the suite manually against WP trunk (7.0) surfaces a real failure: test_FrmStylesController::test_front_head fails on an unrelated WP core incorrect-usage notice.

What changed

  • Added {php: 8.0, wordpress: trunk} to the PHPUnit matrix, alongside the existing 6.9 entries rather than replacing them (transition period - happy to drop 6.9 once trunk actually ships, per the issue's own "Michael's call" on that).
  • test_front_head(): WP core's own wp_maybe_inline_styles() flags a core stylesheet's dist asset as unreadable whenever the WP checkout under test doesn't have its built dist/ files on disk - a property of the checkout (a released branch ships them pre-built; an unbuilt trunk checkout doesn't), not the WP version itself. Nothing Formidable enqueues is involved. Discard the notice if caught rather than requiring it to fire (setExpectedIncorrectUsage() would have required it to fire on every matrix entry, breaking the still-passing 6.9 jobs - caught in self-review before this shipped).
  • First trunk CI run exposed a second, unrelated instance of the same underlying gap: test_FrmFormTemplatesController::test_enqueue_assets errored on a missing wp-admin/css/view-transitions.min.css (same "unbuilt trunk checkout has no dist assets" cause, different core code path). Rather than patching every test that happens to touch a core enqueue path one at a time, added a build step for the trunk leg only (npm ci && npm run build:dev, matching what WordPress core's own CI runs before its PHPUnit suite - :dev so the output lands in src/, where WP_DEVELOP_DIR points here, instead of a separate build/ package directory).
  • Added fail-fast: false - the first trunk failure cancelled both 6.9 jobs before they reported their own result, so there was no actual confirmation the fix left them unaffected.

How verified

Real local PHPUnit run against a WP-core-test-lib checkout on the 7.0 branch (dist assets unbuilt, matching the trunk leg's environment): confirmed red on master (Unexpected incorrect usage notice for wp_maybe_inline_styles), green with the test_front_head fix. Full styles group (18 tests) green after. PHPCS clean on the changed test file. Workflow YAML validated with yaml.safe_load.

Pushed, watching CI for the asset-build addition and the fail-fast: false change - will confirm once it's in and report back if anything's still red.

Closes Strategy11/formidable-pro#6676

🤖 Generated with Claude Code

WP core's own wp_maybe_inline_styles() (unrelated to anything Formidable
enqueues) can flag a core stylesheet's dist asset as unreadable whenever the
WP checkout under test doesn't have its built dist/ files on disk - a
property of the checkout (a released branch ships them pre-built; an
unbuilt trunk checkout doesn't), not the WP version itself. Discard the
notice if it's caught rather than requiring it to fire, so the same test
passes whether or not this environment hits it.

Added trunk alongside the existing 6.9 pin rather than replacing it, so this
can be dropped once WP 7.0 actually ships and 6.9 is no longer the oldest
supported version worth testing.
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 261b7afe-8b79-445c-a4f3-a6045bcdf5c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Sep 17, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 0f12ebb...d5f0002 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Sep 17, 2026 5:34p.m. Review ↗
JavaScript Sep 17, 2026 5:34p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

// checkout, not the WP version under test, so a released-branch job may never
// see it while an unbuilt trunk checkout always does. Discard it either way
// rather than requiring it to fire.
unset( $this->caught_doing_it_wrong['wp_maybe_inline_styles'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Access to an undefined property test_FrmStylesController::$caught_doing_it_wrong


This issue is raised when an attempt is made to access an undefined property.
This may not have been intended, and it is advisable to give the code another look to make sure the property is defined in the scope it is used in.

// checkout, not the WP version under test, so a released-branch job may never
// see it while an unbuilt trunk checkout always does. Discard it either way
// rather than requiring it to fire.
unset( $this->caught_doing_it_wrong['wp_maybe_inline_styles'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Access to an undefined property test_FrmStylesController::$caught_doing_it_wrong


The property you are trying to access is not defined and will cause unexpected behavior when used.

The first trunk run exposed a second, unrelated pre-existing incompatibility:
test_FrmFormTemplatesController::test_enqueue_assets errored on a missing
wp-admin/css/view-transitions.min.css, since a raw trunk checkout has no
built dist/minified assets (a release branch ships them pre-built). Same
root cause as the test_front_head fix, different core code path - rather
than patching every test that happens to touch a core enqueue path
one-by-one, build the missing assets in the trunk leg itself, the same way
WordPress core's own CI does before running its PHPUnit suite.

Also added fail-fast: false - the first trunk failure cancelled both 6.9
jobs before they reported their own result, so there was no actual
confirmation the fix didn't affect them.
The runner's default Node (22.23.2) is older than trunk's own engines.node
requirement (>=24.18.0 as of this writing) - npm ci refused to run at all
(EBADENGINE). Read the version from the checkout's own .nvmrc instead of
assuming the runner default, since this requirement moves with trunk.
@Crabcyborg

Copy link
Copy Markdown
Contributor

Looks like this is handled in #3360

@Crabcyborg Crabcyborg closed this Sep 18, 2026
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.

1 participant