Make sure the following file exists in your /tests folder
https://github.com/laravel/laravel/blob/master/tests/TestCase.php
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I did not know where to put this. But i have the laravel 5.2 package and i am attempting to run some tests and i have the following file "tests/UserTest.php" with the following code:
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class UserTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->visit('/register')
->type('test', 'name')
->type('test@test.com', 'email')
->type('test1', 'password')
->type('test1', 'password_confirmation')
->press('Register')
->seePageIs('/home');
}
}
But when i run this in the cmd line:
php vendor/phpunit/phpunit/phpunit
i get thefollowing output:
PHPUnit 4.8.24 by Sebastian Bergmann and contributors.
Time: 914 ms, Memory: 4.00Mb
No tests executed!
But when i manually put in hte file name:
php vendor/phpunit/phpunit/phpunit tests/UserTest.php
i get this output:
PHP Fatal error: Class 'TestCase' not found in W:\UniXampp\htdocs\tests\UserTest.php on line 7
Fatal error: Class 'TestCase' not found in W:\UniXampp\htdocs\tests\UserTest.php on line 7
Any reason why my test isn't running or whatnot??
Make sure the following file exists in your /tests folder
https://github.com/laravel/laravel/blob/master/tests/TestCase.php
Please or to participate in this conversation.