canadianlover's avatar

PHPUnit test errors after upgrading Homestead

So a couple of days ago I was working on my code when I noticed my Homestead box was crawling on my Windows 10 machine, so I switch over to the NFS file system. One thing led to another where I had to update everything.

I updated to Homestead v10 beta and booted up the machine. Now when I run phpunit I get the following


70) Tests\Feature\ReadThreadsTest::test_a_user_can_request_all_replies_for_a_thr
Error: Class 'Dotenv\Repository\Adapter\EnvConstAdapter' not found

/home/vagrant/.composer/vendor/illuminate/support/Env.php:58
/home/vagrant/.composer/vendor/illuminate/support/Env.php:81
/home/vagrant/.composer/vendor/illuminate/support/helpers.php:276
/home/vagrant/Code/intransportal/vendor/laravel/framework/src/Illuminate/Foundat
/home/vagrant/Code/intransportal/vendor/laravel/framework/src/Illuminate/Foundat
/home/vagrant/Code/intransportal/vendor/laravel/framework/src/Illuminate/Foundat
/home/vagrant/Code/intransportal/vendor/laravel/framework/src/Illuminate/Foundat
/home/vagrant/Code/intransportal/tests/CreatesApplication.php:18
/home/vagrant/Code/intransportal/vendor/laravel/framework/src/Illuminate/Foundat
/home/vagrant/Code/intransportal/vendor/laravel/framework/src/Illuminate/Foundat
/home/vagrant/Code/intransportal/tests/Feature/ReadThreadsTest.php:21
/home/vagrant/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:206
/home/vagrant/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:162

My first instinct was to install the vlucas/dotenv package through composer with no luck. I tried updating the package manager itself, reverting to Homestead 8, trying different versions of PHP with no luck. All of my tests are producing this error. I would greatly appreciate any help I get

0 likes
1 reply
canadianlover's avatar
canadianlover
OP
Best Answer
Level 6

Solved.

Since Laravel uses it's own testing solution, PHPUnit does not ship[ with Homestead. and the latest version is not compatible with Laravel 5.8 (I am using that version since I am following the forum series on this site). So I added the path to the version of phpunit installed in the vendor directory to my ./bashrc file and when I run phpunit now everything works

Please or to participate in this conversation.