[wp-trac] [WordPress Trac] #54420: Tests: Mock REST API remote requests
WordPress Trac
noreply at wordpress.org
Fri Nov 12 03:40:09 UTC 2021
#54420: Tests: Mock REST API remote requests
--------------------------------------+-----------------------------
Reporter: hellofromTonya | Owner: hellofromTonya
Type: task (blessed) | Status: reopened
Priority: normal | Milestone: 6.0
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: rest-api
--------------------------------------+-----------------------------
Comment (by SergeyBiryukov):
Carrying this over from comment:37:ticket:51669:
> Got this again when running multisite tests:
> {{{
> There was 1 error:
>
> 1) WP_REST_Plugins_Controller_Test::test_create_item
> An unexpected error occurred. Something may be wrong with WordPress.org
or this server’s configuration. If you continue to have problems,
please try the <a href="https://wordpress.org/support/forums/">support
forums</a>. (WordPress could not establish a secure connection to
WordPress.org. Please contact your server administrator.)
>
> /var/www/build/wp-admin/includes/plugin-install.php:183
> /var/www/build/wp-includes/rest-api/endpoints/class-wp-rest-plugins-
controller.php:288
> /var/www/build/wp-includes/rest-api/class-wp-rest-server.php:1139
> /var/www/build/wp-includes/rest-api/class-wp-rest-server.php:985
> /var/www/tests/phpunit/includes/spy-rest-server.php:57
> /var/www/build/wp-includes/rest-api.php:479
> /var/www/tests/phpunit/tests/rest-api/rest-plugins-controller.php:379
> }}}
>
> Apparently [49913] and [49951] didn't cover the external HTTP request in
`plugins_api()`. Looks like the `plugins_api()` call in these tests is by
design, so they should probably use the `external-http` group and the
`skipTestOnTimeout()` method, or mock the response.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54420#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list