Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aguirreg's avatar

PHP Fatal error: Class 'Tests\DuskTestCase' not found in ExampleTest.php

I am having problems with Laravel Dusk in my application. I created a new Laravel 5.4 project inside of a Vagrant Box and I installed Dusk according to the directions in the official documentation (https://laravel.com/docs/5.4/dusk). When I run phpunit ExampleTest.php I get the following error:

PHP Fatal error:  Class 'Tests\DuskTestCase' not found in /var/www/my_project/tests/Browser/ExampleTest.php on line 9

Fatal error: Class 'Tests\DuskTestCase' not found in /var/www/my_project/tests/Browser/ExampleTest.php on line 9

and when I run php artisan dusk I get this error:

PHPUnit 5.7.20 by Sebastian Bergmann and contributors.

<br />
<b>Error</b>: <font color="FF0000"><b>Internal script failure</b><br />

I have no idea what is causing this. Tests\DuskTestCase is most definitely in my ExampleTest.php file. Also, my composer.json file is correct, as far as I know. The autoload-dev section is as follows:

"autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
       }

Does anyone have any idea what is going on? I can't seem to find a solution anywhere.

0 likes
1 reply

Please or to participate in this conversation.