Skip to content

Tests: Ensure embed template JS fixtures exist for oembed isolation - #14828

Draft
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/isolate-oembed-directory
Draft

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/isolate-oembed-directory

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

Trac ticket: #65893

What

Ensures required JS assets exist in Tests_Embed_Template::set_up() in tests/phpunit/tests/oembed/template.php.

Why

Embed template tests load theme-compat/embed.php, which prints emoji detection scripts. Those assume wp-includes/js/wp-emoji-loader.js (and wp-embed-template.js) exist. When other suites run first they may already have created those files; when oembed/ runs alone, file_get_contents() fails.

How

  • Calls self::touch() for wp-emoji-loader.js and wp-embed-template.js in set_up().
  • Moves the existing wp-embed-template.js touch out of a single test so every embed template test gets the fixtures.

Testing Instructions

  1. Start the environment: npm run env:start && npm run env:install.
  2. npm run test:php -- --test-suffix .php tests/phpunit/tests/oembed --order-by=random --random-order-seed=1
  3. npm run test:php -- --test-suffix .php tests/phpunit/tests/oembed --order-by=random --random-order-seed=2
  4. npm run test:php -- --test-suffix .php tests/phpunit/tests/oembed
  5. Confirm all three finish with OK.

Use of AI Tools

  • Cursor

Touch wp-emoji-loader.js and wp-embed-template.js in set_up so oembed template tests pass when the directory runs alone.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused test-only change uses the existing fixture helper consistently, with no blocking issues identified; runtime tests were not executed.

No open issues 🎉

What changed in this PR

This PR makes embed template tests independent of suite execution order by ensuring required JavaScript fixtures exist in shared setup.

Changes:

  • Creates the emoji loader fixture in set_up().
  • Moves embed template fixture creation from one test into set_up() so all tests receive it.
File Description
tests/​phpunit/​tests/​oembed/​template.php Ensures both JavaScript fixtures exist before each embed template test.

Review effort: Balanced

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