Skip to content

Tests: Use wp_styles() in the styles ETag test - #13865

Closed
lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:fix/65893-etag-styles
Closed

lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:fix/65893-etag-styles

Conversation

@lancewillett

Copy link
Copy Markdown
Member

Trac ticket: core.trac.wordpress.org/ticket/65893

Tests_Dependencies::test_get_etag_styles() enqueues styles but calls get_etag() on wp_scripts(). Its "should accept one dependency" case only passed because test_get_etag_scripts() had already registered the same handle and version on wp_scripts(), and nothing reset it. Run alone, in reverse order, or at some random seeds, that case gets the hash for an empty list instead.

The test now reads the ETag from wp_styles(), the instance it enqueues to. The expected hashes don't change.

Testing Instructions

  1. Start the environment: npm run env:start && npm run env:install.
  2. Run npm run test:php -- --filter 'Tests_Dependencies::' --order-by=reverse. On trunk: 12 tests, 1 failure. On this branch: 12 tests pass. Default order and seeds 1, 2 and 3 also pass.
  3. The failure first showed up in a random-order run of the top-level test files at seed 1. On this branch, test_get_etag_styles passes in that run.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code, Codex
Model(s): Claude Opus 5.5, gpt-6-astra (Codex review)
Used for: reproducing the failure, making the change, running the tests, and a second-model review


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

`test_get_etag_styles()` enqueues styles but calls `get_etag()` on `wp_scripts()`. Its "should accept one dependency" case only passed because `test_get_etag_scripts()` had already registered the same script handle and version on `wp_scripts()` and nothing reset it. Run alone, in reverse order, or at some random seeds, that case got the hash for an empty list instead.

The test now reads the ETag from `wp_styles()`, the instance it enqueues to.

See #65893.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 lancewillett.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The targeted change correctly aligns the tested instance with the enqueued styles and introduces no unresolved issues.

Review effort: Balanced
Findings: None

What changed in this PR

Corrects the styles ETag test to use the dependency instance where styles are enqueued.

Changes:

  • Replaces wp_scripts() with wp_styles() in test_get_etag_styles().
File Description
tests/​phpunit/​tests/​dependencies.php Makes the styles ETag test independent of test execution order.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

wporg-sync pushed a commit that referenced this pull request Oct 1, 2026
Read the ETag from wp_styles(), where the test enqueues its dependencies, instead of relying on script registrations left by another test.

Developed in: #13865

Props adrianmoldovanwp.
See #65893.


git-svn-id: https://develop.svn.wordpress.org/trunk@64040 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member Author

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 1, 2026
Read the ETag from wp_styles(), where the test enqueues its dependencies, instead of relying on script registrations left by another test.

Developed in: WordPress/wordpress-develop#13865

Props adrianmoldovanwp.
See #65893.

Built from https://develop.svn.wordpress.org/trunk@64040


git-svn-id: http://core.svn.wordpress.org/trunk@63199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants