PHPUnit loads a bootstrap file (usually vendor/autoload.php) before running tests. When that file does not exist in CI - typically because composer install was skipped or run with the wrong working directory - PHPUnit cannot start.
What this error means
PHPUnit aborts before any test with "Cannot open bootstrap script \"vendor/autoload.php\"" or a similar path. The bootstrap configured in phpunit.xml is not present on disk.
composer
PHPUnit 10.5.0 by Sebastian Bergmann and contributors.
Cannot open bootstrap script "vendor/autoload.php".
Confirm phpunit.xml bootstrap points at the real autoloader (e.g. vendor/autoload.php).
Run PHPUnit from the project root so the relative path resolves.
Re-run the suite.
How to prevent it
Always run composer install before PHPUnit in CI.
Keep the phpunit.xml bootstrap path correct relative to the project root.
Run PHPUnit from the repository root in CI steps.
Frequently asked questions
What causes PHPUnit "Cannot open bootstrap script" in CI?
There are 2 common causes: dependencies were never installed and wrong working directory or bootstrap path. composer install did not run (or failed), so vendor/autoload.php was never generated and the bootstrap path is missing.
How do I fix PHPUnit "Cannot open bootstrap script" in CI?
There are 2 fixes depending on which cause you have: install dependencies before running tests and fix the bootstrap path and working directory. Work through them in order, since the first is the most common.
What does PHPUnit "Cannot open bootstrap script" in CI actually mean?
PHPUnit aborts before any test with "Cannot open bootstrap script \"vendor/autoload.php\"" or a similar path.
How do I stop PHPUnit "Cannot open bootstrap script" in CI happening again?
Always run composer install before PHPUnit in CI. The prevention section lists 3 changes that keep it from recurring.