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

后端 未结 13 1151
攒了一身酷
攒了一身酷 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:07

    You may get this error because you namespaced the file. If so you will need to specify that PHPUnit_Framework_TestCase is in the global namespace by preceding it with a backslash:

    namespace AcmeInc\MyApplication\Tests
    class StackTest extends \PHPUnit_Framework_TestCase {}
    

    I submitted a crude PR to start conversation for correcting the documentation.

提交回复
热议问题