Tests: Use wp_styles() in the styles ETag test - #13865
lancewillett wants to merge 1 commit into
Conversation
`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>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
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()withwp_styles()intest_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.
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
|
PR #13865 landed in https://core.trac.wordpress.org/changeset/64040 |
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
Trac ticket: core.trac.wordpress.org/ticket/65893
Tests_Dependencies::test_get_etag_styles()enqueues styles but callsget_etag()onwp_scripts(). Its "should accept one dependency" case only passed becausetest_get_etag_scripts()had already registered the same handle and version onwp_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
npm run env:start && npm run env:install.npm run test:php -- --filter 'Tests_Dependencies::' --order-by=reverse. Ontrunk: 12 tests, 1 failure. On this branch: 12 tests pass. Default order and seeds 1, 2 and 3 also pass.test_get_etag_stylespasses 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.