phpfatal-errorclassnotfoundexception

Why, Fatal error: Class 'PHPUnit_Framework_TestCase' not found in ...?


Why I'm getting this PHP error?

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in ...

Solution

  • The PHPUnit documentation says used to say to include/require PHPUnit/Framework.php, as follows:

    require_once ('PHPUnit/Framework/TestCase.php');
    

    UPDATE

    As of PHPUnit 3.5, there is a built-in autoloader class that will handle this for you:

    require_once 'PHPUnit/Autoload.php';
    

    Thanks to Phoenix for pointing this out!