-
Notifications
You must be signed in to change notification settings - Fork 72
Description
When running WordPress core PHPUnit tests via phpunit-test-runner, tests fail with a fatal error because a generated build artifact is expected under src/, but is actually created under build/.
Specifically, PHPUnit bootstraps WordPress from src/, which requires:
src/wp-includes/build/routes.php`
However, after a successful prepare.php, this file is generated at:
build/wp-includes/build/routes.php
As a result, running test.php fails even though prepare.php exits successfully.
Error output
PHP Warning: require(/tmp/wp-test-runner/src/wp-includes/build/routes.php):
Failed to open stream: No such file or directory in wp-settings.php
PHP Fatal error: Uncaught Error: Failed opening required
'/tmp/wp-test-runner/src/wp-includes/build/routes.php'
What works / what doesn’t
-
php prepare.php
✅ completes successfully
✅ build artifacts are generated underbuild/ -
php test.php
❌ fails because tests bootstrap fromsrc/, where routes.php does not exist
Verified details
routes.phpdoes exist after prepare:
build/wp-includes/build/routes.php
-
vendor/(PHPUnit) lives in the repo root, so pointing tests directly atbuild/breaks PHPUnit execution. -
The runner enforces
WPT_TEST_DIR == WPT_PREPARE_DIRin local mode, which makes it impossible to cleanly switch tobuild/for tests only.
Environment
- Runner:
WordPress/phpunit-test-runner - WordPress source: wordpress-develop (default clone)
- PHP: 8.2.x
- Node: 20.x
- OS: Ubuntu 24.04 (LXD container)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status