solvit.io

PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found

Solution

The most probable reason is that your application upgraded to PHPUnit 6 (for example after running composer update). This PHPUnit version started using PHP namespaces, so classes like PHPUnit_Framework_TestCase no longer exist.

The solution is as simple as replacing this:

class MyTest extends \PHPUnit_Framework_TestCase
{
    // ...
}

by this:

use PHPUnit\Framework\TestCase;

class MyTest extends TestCase
{
    // ...
}

in all your application tests.

Find more solutions about: , , ,