PHPUnit error while creating unit test cases

后端 未结 1 2044
误落风尘
误落风尘 2021-01-07 10:46

i have controller class \"UserController\"(in controller folder) which extends BaseController (present in app folder),

when i right click

相关标签:
1条回答
  • 2021-01-07 11:37

    Your 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
    0 讨论(0)
提交回复
热议问题