Repository navigation
Tests: Cover wp_enqueue_editor() default asset enqueue - #16236
shail-mehta wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The test fails to isolate and restore $wp_scripts and $wp_styles, allowing pre-existing queues to cause false-positive assertions and leftover assets to affect subsequent tests.
1 open issue
What changed in this PR
Adds dedicated regression coverage for wp_enqueue_editor() in WordPress’s PHPUnit suite, addressing Trac #66757 without changing production code.
Changes:
- Checks that the
editorscript andeditor-buttonsstyle are enqueued. - Verifies front-end footer hooks for TinyMCE setup and default editor scripts at priorities 1 and 45.
| File | Description |
|---|---|
tests/phpunit/tests/general/wpEnqueueEditor.php |
Adds a test for default editor assets and footer hook priorities. |
Review effort: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
lancewillett
left a comment
There was a problem hiding this comment.
I removed the editor-buttons enqueue and the new test failed on that assertion. Restoring the line passed the randomized General suite in both modes. The fresh asset registries make the check meaningful even when an earlier test has already queued the editor. Short messages on the two footer hook assertions would make failures easier to diagnose.
Before landing, please link a ticket in the component that owns the code under test, per the 7.3 ticket guidance. Related coverage can share a component ticket.
AI review · gpt-6.2-astra
|
Thanks for the review and for creating #66822! I've updated the @ticket annotation to 66822 (the PR description already links it), and added short failure messages to the two wp_print_footer_scripts assertions. |
lancewillett
left a comment
There was a problem hiding this comment.
Confirmed the test checks both footer hook priorities and now identifies each callback if an assertion fails. The revised test passed on single-site and multisite.
AI review · gpt-6.2-astra
|
@afercia Could you take a look at this test from the component side? It passed the focused PHPUnit run on both single-site and multisite. |
lancewillett
left a comment
There was a problem hiding this comment.
The admin-footer case catches a real regression: moving the callback to the front-end hook failed the new assertion. Please drop the one redundant screen reset before landing.
AI review · gpt-6.2-astra
lancewillett
left a comment
There was a problem hiding this comment.
The revised tests passed in single-site and multisite, including admin first and front end second. Moving only the admin print callback to the front-end footer hook failed the admin test in both modes. Inherited teardown covers the removed screen reset.
The Editor component review remains with Andrea before landing.
AI review · gpt-6.2-sol

What
Trac ticket: https://core.trac.wordpress.org/ticket/66822
Adds a unit test for
wp_enqueue_editor()that checks:editorscript is enqueuededitor-buttonsstyle is enqueuedforce_uncompressed_tinymcehooked onwp_print_footer_scriptsat priority 1print_default_editor_scriptshooked onwp_print_footer_scriptsat priority 45Why
wp_enqueue_editor()had no dedicated coverage. Removing theeditor-buttonsenqueue or the footeradd_actioncalls left existing tests green.How
Calls
wp_enqueue_editor()once and asserts enqueue /has_actionstate directly (front-end branch; PHPUnit is not in admin by default).Testing
npm run test:php -- --filter Tests_General_WpEnqueueEditor— 1 test passeswp_enqueue_style( 'editor-buttons' )→ style assertion failsadd_actioncalls →has_actionassertions failUse of AI Tools