Tests: Read the video shortcode instance number in test_video_shortcode_body() - #13904
Open
lancewillett wants to merge 1 commit into
Open
lancewillett wants to merge 1 commit into
lancewillett wants to merge 1 commit into
Conversation
…ode_body()`. `wp_video_shortcode()` numbers every call with a static counter and puts the number in the player's `id` and the source's `_` query argument. The test expected `1`, which holds only when it makes the first `wp_video_shortcode()` call in the process. When an earlier test has called it, such as `Tests_Widgets_wpWidgetMediaVideo`, the numbers differ and the test fails. The test now records the number from the `wp_video_shortcode_override` filter and builds the expected markup with it. The rest of the expected markup is unchanged. See #65893. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
adimoldovan
approved these changes
Oct 2, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Trac ticket: core.trac.wordpress.org/ticket/65893
wp_video_shortcode()numbers every call with a static counter. It puts the number in the player'sid(video-%d-%d) and in the source's_query argument.Tests_Media::test_video_shortcode_body()expected1, which holds only when it makes the firstwp_video_shortcode()call in the process. When an earlier test has called it, such asTests_Widgets_wpWidgetMediaVideo, the numbers differ and the test fails. In a random-order full run it gotvideo-0-14.The test now records the number from the
wp_video_shortcode_overridefilter, which receives the same counter just before the markup is built. It then builds the expected markup with that number. The filter returns its input unchanged, and the base test case removes it afterward. The rest of the expected markup is unchanged.Running this test in a separate process was tried first and dropped: the child process removes the class's shared attachment fixtures, which breaks 84 other
Tests_Mediatests.Testing Instructions
npm run env:start && npm run env:install.tests/phpunit/tests/widgets/wpWidgetMediaVideo.phpand thentests/phpunit/tests/media.phpas<file>entries in a copy ofphpunit.xml.dist. Run it with-cand--filter 'Tests_Widgets_wpWidgetMediaVideo|test_video_shortcode_body'. Ontrunk,test_video_shortcode_bodyfails. On this branch, all 9 tests pass.npm run test:php -- --filter Tests_Mediain default order,--order-by=reverse, and seeds 1, 2 and 3, plus-c tests/phpunit/multisite.xml.test_video_shortcode_bodypasses in all of them. (test_img_caption_shortcode_with_old_format_id_and_alignfails in reverse and at seeds 1 and 3 ontrunktoo; Tests: Improve isolation for randomized media tests #13190 addresses it.)--order-by=random --random-order-seed=1: the video failure is gone, with no new failures.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code, Codex
Model(s): Claude Opus 5.5, gpt-6-astra (Codex review)
Used for: finding the cause, making the change, running the tests, and a second-model review
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code