Tests: Stop the no-theme-support title test from removing support - #13861
lancewillett wants to merge 1 commit into
Conversation
`Tests_General_wpGetDocumentTitle::test__wp_render_title_no_theme_support()` called `remove_theme_support( 'title-tag' )`, and nothing restored it, so `test__wp_render_title_tag()` and `test__wp_render_title_tag_with_blog_description()` failed whenever they ran after it. The class's `after_setup_theme` callback never fires during a test, and adding the support again after `wp_loaded` triggers a doing-it-wrong notice. The test now filters `current_theme_supports-title-tag` to return false, which the base test case removes after each test. 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 filter exercises the intended branch and is automatically restored during test teardown.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents document-title tests from leaking theme-support state across tests.
Changes:
- Uses a temporary filter to simulate missing
title-tagsupport without mutating global theme support.
| File | Description |
|---|---|
tests/phpunit/tests/general/wpGetDocumentTitle.php |
Isolates the no-theme-support test. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Trac ticket: core.trac.wordpress.org/ticket/65893
Tests_General_wpGetDocumentTitle::test__wp_render_title_no_theme_support()callsremove_theme_support( 'title-tag' ), and nothing restores it. Any timetest__wp_render_title_tag()ortest__wp_render_title_tag_with_blog_description()runs after it, those two fail. The class'safter_setup_themecallback never fires during a test, and adding the support back afterwp_loadedtriggers a doing-it-wrong notice.The test now filters
current_theme_supports-title-tagto return false._wp_render_title_tag()only checkscurrent_theme_supports(), so the no-support path is still covered, and the base test case removes the filter after the test.Testing Instructions
npm run env:start && npm run env:install.npm run test:php -- --filter Tests_General_wpGetDocumentTitle --order-by=reverse. Ontrunk: 19 tests, 2 failures. On this branch: 19 tests pass.npm run test:php -- --test-suffix .php tests/phpunit/tests/general --order-by=random --random-order-seed=3. Ontrunk: 1 failure (test__wp_render_title_tag). On this branch: 318 tests pass. Default order and seeds 1 and 2 also pass.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.