[wp-trac] [WordPress Trac] #63590: Youtube oEmbed Test is not loading scripts
WordPress Trac
noreply at wordpress.org
Wed Jun 18 11:22:55 UTC 2025
#63590: Youtube oEmbed Test is not loading scripts
--------------------------+---------------------------------------
Reporter: SirLouen | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Embeds | Version: 5.5
Severity: normal | Keywords: needs-patch has-test-info
Focuses: tests |
--------------------------+---------------------------------------
After breaking my head for half an hour because the tests were not
passing, I started debugging to find that a random test in the `restapi`
group is failing.
Personally I thought that the full `restapi` tests were passing in the GH
CI, but its seems not.
The particular test is:
`Test_oEmbed_Controller::test_proxy_with_classic_embed_provider`
Easily run with: `npm run test:php -- --group 45447`
{{{
There was 1 error:
1) Test_oEmbed_Controller::test_proxy_with_classic_embed_provider
Attempt to read property "queue" on null
/var/www/src/wp-includes/class-wp-oembed-controller.php:211
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:1292
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:1125
/var/www/tests/phpunit/includes/spy-rest-server.php:71
/var/www/tests/phpunit/tests/oembed/controller.php:613
ERRORS!
Tests: 1, Assertions: 2, Errors: 1.
}}}
The problem is that `wp_scripts()` are not being called at any point in
the tests, [https://github.com/SirLouen/wordpress-develop/blob/trunk/src
/wp-includes/class-wp-oembed-controller.php#L212 so it fails here] with an
empty array.
Patch first introduced in [48135], I can't really see when and how the
test was broken.
After spending a ton of time rolling back into WP 5.5 `wordpress-develop`
`8368cc2b4410fe2834dd7e9012fe6d4f4919a721` testing suite (but with current
`trunk` code) to check tests with my eyes this is what I found:
{{{
There was 1 error:
1) Test_oEmbed_Controller::test_proxy_with_classic_embed_provider
Trying to get property 'queue' of non-object
/var/www/src/wp-includes/class-wp-oembed-controller.php:211
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:1292
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:1125
/var/www/tests/phpunit/includes/spy-rest-server.php:71
/var/www/tests/phpunit/tests/oembed/controller.php:624
phpvfscomposer:///var/www/vendor/phpunit/phpunit/phpunit:60
ERRORS!
Tests: 1, Assertions: 2, Errors: 1.
}}}
Exactly the same results but different lines, because as I say I was
running 5.5 test suite on trunk, this is why core files have the same
lines.
Since this test has never run on the GH CI and it was failing since day
one, we could say that it safe to be patched (for sanity purposes, when
running `restapi` group). I have not run the test straight on WP 5.5 but
its safe to say that the test suite has never been complete to cover this
case.
Conclusion, we simply need to add `wp_scripts()` somewhere in the code
(maybe in `setUp()`) so the global wp_scripts is initialized in order to
run successfully though
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63590>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list