Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class 'MY_Controller' not found #2

Open
carlotrimarchi opened this issue May 28, 2013 · 1 comment
Open

Class 'MY_Controller' not found #2

carlotrimarchi opened this issue May 28, 2013 · 1 comment

Comments

@carlotrimarchi
Copy link

Hi,
I'm following the handbook 3 on Unit Testing. In chapter 3, at page 31, when it says to make the class Trackers to extend MY_Controller I get this error:

Configuration read from /home/carlo/public_html/photocircle_relaunch/phpunit.xml

PHP Fatal error: Class 'MY_Controller' not found in /home/carlo/public_html/photocircle_relaunch/application/controllers/Trackers.php on line 3
PHP Stack trace:
PHP 1. {main}() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/composer/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/composer/bin/phpunit:63
PHP 3. PHPUnit_TextUI_Command->run() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
PHP 6. PHPUnit_Framework_TestSuite->run() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
PHP 7. PHPUnit_Framework_TestSuite->runTest() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
PHP 8. PHPUnit_Framework_TestCase->run() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
PHP 9. PHPUnit_Framework_TestResult->run() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:776
PHP 10. PHPUnit_Framework_TestCase->runBare() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
PHP 11. PHPUnit_Framework_TestCase->runTest() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:831
PHP 12. ReflectionMethod->invokeArgs() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:976
PHP 13. TrackersTest->testModelsAreAutoloaded() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:976
PHP 14. Composer\Autoload\ClassLoader->loadClass() /home/carlo/public_html/photocircle_relaunch/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:0
PHP 15. include() /home/carlo/public_html/photocircle_relaunch/vendor/composer/ClassLoader.php:185

I reviewed again all the previous steps but it seems to me I followed all the instructions. Still, I think I'm missing something. Can you help me finding what's wrong?

@carlotrimarchi
Copy link
Author

It seems that one of the problem was that in the phpunit.xml file the bootstrap parameter was set like this, as explained on page 12:

bootstrap="vendor/autoload.php"

while in the file in the github repository is like this:

bootstrap="bootstrap.php"

Then I also had to remove the "require_once" from public/index.php.
Is this correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant