Repository navigation
Tests: Add unit tests for get_header_video_settings(). - #16189
rejaulalomkhan wants to merge 2 commits into
Conversation
Cover default settings structure, YouTube mimeType resolution, direct video filetype detection, and header_video_settings filter. See #38172.
|
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:
|
There was a problem hiding this comment.
🟡 Changes recommended
The new tests use @group theme instead of @group themes, excluding them from targeted PHPUnit theme runs.
1 open issue
What changed in this PR
Adds dedicated PHPUnit coverage for get_header_video_settings(), strengthening tests for WordPress custom-header video settings without changing production code.
Changes:
- Checks the default settings structure, playback thresholds, and localization keys.
- Covers YouTube URL variants and direct MP4 MIME detection and URL handling.
- Verifies that the
header_video_settingsfilter can modify and extend settings.
| File | Description |
|---|---|
tests/phpunit/tests/theme/getHeaderVideoSettings.php |
Adds six test cases covering defaults, video sources, and settings filtering. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
The useful regression here is choosing the right player for YouTube and direct video URLs. Could you focus on the URL-to-MIME cases and drop the default-array inventory? Please also remove the blanket remove_all_filters() teardown. The base test case restores the hooks after each test.
Please use the existing themes test group and link any retained coverage to an open component ticket. The historical ticket can stay as context.
AI review · gpt-6
|
Thanks for the review and guidance, @lancewillett! Updated per your feedback:
All single-site, multisite, and reverse-order tests pass with 0 PHPCS errors. AI assistance · |
lancewillett
left a comment
There was a problem hiding this comment.
This now tests the MIME type the header player actually uses. Removing the YouTube mapping failed the three YouTube cases locally. The shared test harness restores the filter after each case, so dropping the blanket teardown was the right change.
The code looks ready. As Copilot spotted, the description still promises default settings and filter coverage. Please update the description to match this narrower test. Please link the open Themes coverage ticket before landing; #38172 records the original feature.
AI review · gpt-6
Cover the MIME type and video URL returned by `get_header_video_settings()` for YouTube, direct video files and an unset URL. Developed in: #16189 Follow-up to r38985. Props rejaulalomkhan. Fixes #66825. git-svn-id: https://develop.svn.wordpress.org/trunk@65786 602fd350-edb4-49c9-b593-d223f7449a82
Cover the MIME type and video URL returned by `get_header_video_settings()` for YouTube, direct video files and an unset URL. Developed in: WordPress/wordpress-develop#16189 Follow-up to r38985. Props rejaulalomkhan. Fixes #66825. Built from https://develop.svn.wordpress.org/trunk@65786 git-svn-id: http://core.svn.wordpress.org/trunk@64815 1a063a9b-81f0-0310-95a4-ce76da25c4cd


Description
Adds dedicated unit tests for
get_header_video_settings()insrc/wp-includes/theme.php, which was introduced in [38985] (#38172) but lacked dedicated unit tests.The data provider exercises eight URLs: three YouTube formats, three direct video files, an unknown extension, and an empty URL. Each case checks the MIME type and video URL used by the header player.
Testing Instructions
Run single-site and multisite test suites and coding standards:
Trac ticket: https://core.trac.wordpress.org/ticket/66825
This Pull Request is for code review only. Please keep all other discussion to the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
Use of AI Tools
AI assistance: Yes
Tool(s): Google Antigravity
Model(s): Gemini 3.8 Flash
Used for: Identifying untested theme function, authoring PHPUnit test cases, and running verification suites locally. I reviewed every line, ran the tests, and take responsibility for the change.