Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sun4lower/fcc907f930805977f359ff3683eada87 to your computer and use it in GitHub Desktop.
Save sun4lower/fcc907f930805977f359ff3683eada87 to your computer and use it in GitHub Desktop.
Fatal error: Class 'PHPUnit_Framework_TestCase' not found in ...
Fatal error: Class 'PHPUnit_Framework_TestCase' not found
You want to use PHPUnit 6
PHPUnit 6 requires PHP 7.0 or PHP 7.1. It introduces significant changes that require a migration of your existing test suite to PHPUnit 6.
If you use Composer to manage PHPUnit as a dependency of your project and want to use PHPUnit 6 then you should depend on "phpunit/phpunit": "^6.0" in your composer.json file.
If you use PHPUnit from a PHP archive (PHAR) and want to use PHPUnit 6 then you can download PHPUnit from https://phar.phpunit.de/phpunit.phar.
Below you find a list of things to do and keep in mind while migrating your existing test suite to PHPUnit 6:
PHPUnit_Framework_TestCase is now PHPUnit\Framework\TestCase
PHPUnit's units of code are now namespaced. Among other things, this means that your test case classes now need to extend PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase.
While PHPUnit 5.7 has a forward compatibility layer, meaning you can already use PHPUnit\Framework\TestCase with that version, there is no backward compatibility layer in PHPUnit 6 that allows you to use PHPUnit_Framework_TestCase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment