Env: WP_TESTS_DOMAIN
constant in phpunit-wp-config.php
is defined to invalid value
#41038
Labels
WP_TESTS_DOMAIN
constant in phpunit-wp-config.php
is defined to invalid value
#41038
Description
Apologies if this is not the right place to report this, but I'm having trouble finding the repo responsible for the
/var/www/html/phpunit-wp-config.php
in the wp-env Docker container. My file is including the following constants:The
WP_TESTS_DOMAIN
here is wrong as it should be just the host name, specificallylocalhost
. This is causing my unit tests to fail which are attempting to use$_SERVER['HTTP_HOST']
to construct the current URL, resulting in a malformedhttp://http://localhost:8889//current-page/
when I expecthttp://localhost:8889/current-page/
. In the WordPress core tests functiontests_reset__SERVER()
, it does:Where are these constants being generated? I'm guessing somehow via
build-docker-compose-config.js
? I tried overriding this by constructing a.wp-env.json
that had:But then running
start
failed with:This error appears to be due to this line:
gutenberg/packages/env/lib/config/config.js
Lines 299 to 300 in 7a347c0
Since
WP_TESTS_DOMAIN
is in fact not a URL but rather a hostname.Step-by-step reproduction instructions
Start an environment and check
$_SERVER['HTTP_HOST']
and the value ofWP_TESTS_DOMAIN
defined in thewordpress-tests
container file/var/www/html/phpunit-wp-config.php
. The string will be erroneously a full URL rather than a hostname.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: