Fatal error: Class 'CDbTestCase' not found yii framework

后端 未结 3 706
梦如初夏
梦如初夏 2021-01-26 07:07

I\'m following the \"Agile web application development with yii 1.1 and php5\" book and i\'m at the testing with fixtures section. I followed their code but i can\'t access to t

相关标签:
3条回答
  • 2021-01-26 07:42

    In your framework directory there should be a dir named test and within it there should be CDbTestCase.php. can you verify this please? if it's missing you've found the problem, else your code cannot reach the framework dir.

    0 讨论(0)
  • 2021-01-26 07:42

    I encountered the same problem while using PHPStorm. It works when I run the tests (ctrl+shift+F10) while standing on the directory 'unit', but will not work if I stand on the test file itself.

    0 讨论(0)
  • 2021-01-26 07:54

    check if you bootstrap file in pŕotected/tests is pointing to the right paths and check if the WebTastCase.php file in the same folder is poiting to the right 'TEST_BASE_URL', something like:

    define('TEST_BASE_URL','http://localhost/my_app/index-test.php/');
    

    and try to run phpunit from inside the protected/tests folder

    0 讨论(0)
提交回复
热议问题