PHPUnit error while creating unit test cases
i have controller class "UserController"
(in controller folder) which extends BaseController
(present in app folder),
when i right click and select option "Create PHPUnitTests"
it gives me following error:
php开发者_开发知识库unit Fatal error: Class 'Base Controller' not found
can ayone tell me why i get this error and what i have to configure for the same.
I using custom php frameworkYour Include Path is likely not configured correctly for your IDE. For Netbeans, follow the instructions given in the Netbeans User Manual:
- http://netbeans.org/kb/docs/php/project-setup.html#phpIncludePath
If you are not using include
statements to include the files to be tested in the UnitTests, you also have to bootstrap the environment. Executing the UnitTests from the IDE will likely not run your regular bootstrap file. Consider adding a phpunit.xml file to your tests:
<phpunit backupGlobals="true"
backupStaticAttributes="false"
<!--bootstrap="/path/to/bootstrap.php"-->
colors="false"
…
<php>
<includePath>.</includePath>
See the Appendix in the PHPUnit Manual for more information:
- https://phpunit.de/manual/current/en/appendixes.configuration.html
Follow the instructions given in the Netbeans User Manual to make the IDE consider the file automatically when tests are run:
- http://blogs.oracle.com/netbeansphp/entry/recent_improvements_in_phpunit_support
精彩评论