Skip to content

Improve Yoast SEO integration coverage; drop obsolete fixHomeBreadcrumbs - #19

Merged
nlemoine merged 2 commits into
mainfrom
test/wordpress-seo-coverage
Jun 3, 2026
Merged

Improve Yoast SEO integration coverage; drop obsolete fixHomeBreadcrumbs#19
nlemoine merged 2 commits into
mainfrom
test/wordpress-seo-coverage

Conversation

@nlemoine

@nlemoine nlemoine commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

Raises Yoast SEO integration coverage from ~56% to ~95%, and removes one method that became dead code as Yoast evolved.

New tests (WordPressSeoTest)

  • Indexables::configurePageDetection (31% → 100%) — including the pre_option_show_on_front workaround, the core trick that makes Yoast resolve PFCPT pages instead of the posts page.
  • Schema (58% → 100%) — the CollectionPage idempotency branch.
  • WordPressSeo composite (0% → 100%) — isSupported() / registerHooks() boot.
  • A fixTaxonomyBreadcrumbs guard (current taxonomy is not the post type's main taxonomy).

Removal — Breadcrumbs::fixHomeBreadcrumbs

This method only ran when Yoast's get_page_type() returned Home_Page for a PFCPT page. That held in Yoast ~17 (when the logic was first written, late 2021), but Yoast has since moved is_static_posts_page() onto the $wp_query->is_posts_page flag — which the plugin's Handler always sets — and checks it before the Home_Page branch. PFCPT pages now resolve to Static_Posts_Page, so the method is unreachable.

Verified against Yoast 25.9 and 27.7, with and without Polylang, and with breadcrumbs-home set — every combination resolves to Static_Posts_Page. Git history preserves the method if a future Yoast ever regresses.

Result

src/Integration/WordPressSeo/: Indexables / Schema / WordPressSeo at 100%, Breadcrumbs at 91% (the remaining lines are defensive early-return guards). phpcs and PHPStan clean; 12 WordPressSeoTest tests pass.

nlemoine added 2 commits June 3, 2026 12:42
…posite

Add tests for previously-uncovered Yoast integration logic: Indexables::configurePageDetection including the pre_option_show_on_front workaround that makes Yoast resolve PFCPT pages (31% -> 100%); Schema CollectionPage idempotency (58% -> 100%); the WordPressSeo composite boot/registerHooks (0% -> 100%); and a fixTaxonomyBreadcrumbs guard for a non-main taxonomy.
fixHomeBreadcrumbs only ran when Yoast's get_page_type() returned 'Home_Page' for a PFCPT page. That held in Yoast ~17 (when the logic was first written, late 2021), but Yoast has since moved is_static_posts_page() onto the $wp_query->is_posts_page flag -- which Handler always sets -- and checks it before the Home_Page branch. PFCPT pages now resolve to Static_Posts_Page, so the method is unreachable on every supported Yoast.

Verified against Yoast 25.9 and 27.7, with and without Polylang and with breadcrumbs-home set: all resolve to Static_Posts_Page.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.34%. Comparing base (b6d0c01) to head (fe4cb84).

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #19      +/-   ##
============================================
+ Coverage     87.42%   90.34%   +2.91%     
+ Complexity      494      485       -9     
============================================
  Files            31       31              
  Lines          1336     1315      -21     
============================================
+ Hits           1168     1188      +20     
+ Misses          168      127      -41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nlemoine
nlemoine merged commit 7e45b27 into main Jun 3, 2026
33 checks passed
@nlemoine
nlemoine deleted the test/wordpress-seo-coverage branch June 3, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants