1

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:

phpunit 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 framework

2
  • netbeans? is your framework in your IDE include-path? tried to edit the UserController an include the BaseController` by hand? include_once('path/to/BaseController.php'); Commented Dec 3, 2010 at 10:20
  • i added the include path in bootstrap.php so that it can be available globally for other controllers also And That is working for me Commented Dec 4, 2010 at 13:46

1 Answer 1

2

Your Include Path is likely not configured correctly for your IDE. For Netbeans, follow the instructions given in the Netbeans User Manual:

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:

Follow the instructions given in the Netbeans User Manual to make the IDE consider the file automatically when tests are run:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.