test: cover Fix_News_Dependencies_Integration - #23463
Conversation
Use get_current_screen() instead of WP_Screen::get() when detecting the block editor during asset enqueue. WP_Screen::get() re-applies the replace_editor filter and double-renders custom editors that include admin-header.php. Fixes Yoast#23462
This comment has been minimized.
This comment has been minimized.
…or-recursion # Conflicts: # admin/metabox/class-metabox.php # src/integrations/admin/fix-news-dependencies-integration.php # src/integrations/third-party/elementor.php
Add cases for the post edit pages and for a screen where the enqueue hook must not be registered. Refs Yoast#23462
|
Update on this PR, plus a note on the two red checks. The source fix is already on trunk. Commit 6ef9a30 moved the block editor check into I kept the part trunk does not have: unit tests for Two checks fail for reasons outside this branch:
|
Context
The
replace_editorrecursion fix this PR originally carried has already landed ontrunkin 6ef9a30, where the block editor check was moved intoCurrent_Page_Helper::is_block_editor()and made null-safe withget_current_screen(). After mergingtrunk, the three source files this PR touched (admin/metabox/class-metabox.php,src/integrations/admin/fix-news-dependencies-integration.php,src/integrations/third-party/elementor.php) are identical totrunk, so no production code changes remain here.What is left is the part
trunkdoes not have: unit test coverage forFix_News_Dependencies_Integration. That class had no test file at all. This PR keeps only that coverage, so it is now a test-only, non-user-facing change.Requested changelog label:
changelog: non-user-facing.Summary
This PR can be summarized in the following changelog entry:
Fix_News_Dependencies_Integration.Relevant technical choices:
register_hooks()is covered for both post edit pages (post.php,post-new.php) and for a screen where the enqueue hook must not be registered.add_news_script_dependency()is covered for the block editor handle, the classic editor handle, and the bail when thewpseo-news-editorscript is not registered.Current_Page_Helper, so the tests follow the constructor injection the class already uses and do not touchWP_Screenor globals other than$pagenow.Test instructions
Test instructions for the acceptance test before the PR gets merged
Not applicable. This PR only adds unit tests and changes no production code. CI runs the suite; locally it is
composer test -- --filter Fix_News_Dependencies_Integration_Test.Relevant test scenarios
Test instructions for QA when the code is in the RC
Not applicable. There is no user-facing behaviour to verify.
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand committed the results, if my PR introduces or edits images or SVGs.Innovation
innovationlabel.Refs #23462