nunodonato's avatar

artisan test is broken when vendor folder is outside the project

Hi folks

I've been trying to solve this issue for a long time, but no luck. In the app I'm working on, the vendor folder is outside the project folder (reasons, don't ask :). These created a couple of challenges, but everything got sorted out and is working fine now. Well, everything except artisan test, which for some reason keeps resulting in this error message

Could not open input file: vendor/phpunit/phpunit/phpunit

The vendor folder is setup correctly in the .env file, and in the phpunit.xml we also have bootstrap="../vendor/autoload.php"

Any other things I can try? I fear this might be something hardcoded into artisan :/

So far I have been running tests with: ../vendor/phpunit/phpunit/phpunit

0 likes
4 replies
tisuchi's avatar

@nunodonato Make sure you specify the full path to the PHPUnit executable in the phpunit.xml file.

You can try running the test using the command php path/to/vendor/phpunit/phpunit/phpunit to see if the tests run correctly.

nunodonato's avatar

@Sinnbeck I was afraid this was the case :( thanks for the link, i had no idea the test command was actually part of Collision! That's why I couldn't find it :)

Sinnbeck's avatar

@nunodonato Yeah its a bit weird. I only know it as I read the code while implementing the package in a non-laravel project

Here is a small idea. Do a symlink just before running the tests. Then the vendor folder is present in both places

ln -s ../path/to/vendor /vendor
1 like

Please or to participate in this conversation.