[pull] main from nlemoine:main - #7
Merged
Merged
Conversation
Polylang 3.7+ requires src/api.php (which defines PLL() and the pll_* API) only from init_context(), and init() reaches init_context() only when it detects a context: admin, REST, or frontend-with-languages. Under PHPUnit there is no request context and languages are created per test (after Refresh_Database rolls them back), so init() saw an empty context, returned before loading the API, and PLL() stayed undefined. Every PolylangTest then skipped via markTestSkipped, leaving src/Integration/Polylang at 0% coverage. Force a frontend context through the pll_context filter so init_context() runs and loads the API. The whole PolylangTest suite now executes (0 -> ~79% line coverage on the Polylang integration).
AdminScreenTest::setUp gated the wp-admin/includes/plugin.php include on function_exists('register_setting'), but register_setting is a core function (wp-includes/option.php) that is always defined, so the include never loaded. add_submenu_page() — which lives in that admin include — was then undefined on WP builds that don't load it independently, erroring testAddPostTypeSubmenusAddsSubmenus. Guard on add_submenu_page() instead.
…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.
…b guards Exercises the public integration methods directly: the Autodescription composite isSupported()/registerHooks() (0% -> 100%); QueryType::markPfcptAsSingularArchive — the already-archive short-circuit and explicit-id resolution (40% -> 100%); and Breadcrumbs::addPfcptPageCrumb argument-resolution guards (78% -> 92.5%).
The deprecated global function shims are guarded by function_exists() checks that execute during Composer's files autoload -- before PHPUnit starts collecting coverage -- so those lines can never be covered. Wrap the back-compat block in @codeCoverageIgnore; the shim bodies are still exercised by PublicApiTest. Also add a test for get_page_id_for_custom_post_type() called with no post type outside a PFCPT query (the query-var fallthrough). functions.php goes 78% -> 93%.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )