http://localhost/laravel/app/tests/ExampleTest.php
if i run laravel it shows the following error
Fatal error: Class \'TestCase\' not found in D
Had the same issue with PHPUnit, he would output always the same message : PHP Fatal error: Class 'Tests\TestCase' not found ...
and indeed I think he had troubles to find that class so what you need to do is transform one line :
From this :
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class AnotherTest extends TestCase {
public function testExample() {
// Do something
}
}
To this :
<?php
namespace Tests\Feature;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class AnotherTest extends TestCase {
public function testExample() {
// Do something
}
}
Notice the first line in use and you should do this if there's any other files in the same case
The is caused by an outdated phpunit. If you using a globally installed phpunit, here is a link on how to update it https://stackoverflow.com/a/40701333/3792206 . Or you can explicitly use the phpunit that was installed with the project.