Fatal error: Class 'TestCase' not found in (laravel) Php Storm

I am creating a new laravel structure from composer and when running on PHP Storm I am facing this error in PHP Storm

Fatal error: Class 'TestCase' not found in C: \ xampp \ htdocs \ testproject \ app \ tests \ ExampleTest.php on line 3

cd C: \ xampp \ htdocs \ testproject Current working directory 'C: \ XAMPP \ HTDOCS \ TestProject'.

phpunit

The program cannot be started "phpunit"

(in the directory "C:\xampp\htdocs\testproject"

): CreateProcess error = 2, the system cannot find the file specified

+3


source to share


3 answers


I've had this problem in the past with Laravel 4 and 5. It turns out I was missing this in my composer.json.

Laravel 5:

"autoload-dev": {
    "classmap": [ "tests/TestCase.php" ]
},

      



Laravel 4:

"autoload-dev": {
    "classmap": [ "app/tests/TestCase.php" ]
},

      

+2


source


I think the laravel path is a setting to be in the root of a specific project and then specify the rest for phpunit.

1.) alias phpunit = 'vendor / bin / phpunit'



Try changing your path to "C: \ xampp \ htdocs \ testproject" then run "alias phpunit = 'vendor / bin / phpunit" then run "phpunit app / tests / ExampleTest.php".

http://culttt.com/2013/05/20/getting-started-with-testing-laravel-4-models/

0


source


You need to run phpunit

in the folder where you have your tests.

Run this from the command line from your project root:

phpunit app/tests/

      

0


source







All Articles