Repository navigation
SEO: Keep the empty-language schema test passing on WordPress trunk - #53264
Conversation
WordPress 7.2 ignores an empty value from the `locale` filter and falls back to en_US, so the test's empty locale no longer produced an empty language and `inLanguage` appeared. The PHP 8.4 WP trunk job fails on every PR that runs the SEO tests. Blank the `html_lang_attribute` translation instead: get_bloginfo() returns an empty translation as-is on every WordPress version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
Codex reviewThe revised test reliably produces an empty language value without relying on an empty locale filter, and cleans up the added filter. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused test compatibility fix is correct, isolated, and properly cleaned up.
Review effort: Balanced
Findings: None
What changed in this PR
Updates the SEO schema test to remain compatible with WordPress 7.2 trunk.
Changes:
- Simulates an empty language through
gettext. - Cleans up the added filter and records the test-only change.
| File | Description |
|---|---|
projects/packages/seo/tests/php/WebsiteSchemaNodeTest.php |
Updates empty-language setup and cleanup. |
projects/packages/seo/changelog/fix-seo-website-schema-empty-language-test |
Records the test-only compatibility update. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Merged this to unblock trunk. Open to suggestions on a better fix! |
Why
The "PHP tests: PHP 8.4 WP trunk" job fails on every PR that runs the SEO package tests, for example #53011. WordPress trunk (7.2) now ignores an empty value from the
localefilter and falls back toen_US.WebsiteSchemaNodeTest::test_optional_fields_omitted_when_emptyused that empty filter to fake a site with no language, so on trunk the language isen-USandinLanguageappears. The SEO code is correct; only the test's setup stopped working.Proposed changes
html_lang_attributetranslation throughgettext, in place of an emptylocale.get_bloginfo( 'language' )returns an empty translation as-is on every WordPress version, so the test still reaches the "no language" branch.tearDown()also clearsgettext. No other test in the package filters it.Test-only, so the changelog entry is empty with a comment.
Verification
roots/wordpress:dev-main(7.2-alpha-64163) in the PHP test environment, as the WP trunk job does.'' !== $languageguard removed, the test fails, so it still catches an emptyinLanguage.Related product discussion/links
get_locale()anddetermine_locale()now discard an empty or non-string filtered value.Does this pull request change what data or activity we track or use?
No.
Testing instructions
packages/seo.jp test php packages/seopasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL