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

后端 未结 13 1148
攒了一身酷
攒了一身酷 2020-11-29 19:23

Why I\'m getting this PHP error?

Fatal error: Class \'PHPUnit_Framework_TestCase\' not found in ...
13条回答
  •  半阙折子戏
    2020-11-29 20:15

    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!

提交回复
热议问题