Hello everyone.
First some basic info:
- Ubuntu latest version
- Zend Framewrok 1.9.6
- Doctrine 1.2.1
- Php unit latest version
I have been following this and thistutorial to set up my zend envrionment with doctrine and phpUnit.
My environment is not an emtpy project since I had done some developments before I configured doctrine and phpunit. I have created some db classes in my models/DbTable/ folder. The problem is that the files in this folder cause a problem by running phpunit.
This is the error I get:
Fatal error: Cannot redeclare class JS_Model_DBTable_Addresses in /var/www/nrka/application/models/DbTable/addresses.php on line 19
Call Stack:
0.0007 62480 1. {main}() /usr/bin/phpunit:0
0.1662 4484880 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:52
0.1663 4485612 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:147
0.1663 4485860 4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:156
0.1678 4491132 5. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/TextUI/Command.php:786
0.1682 4504132 6. include_once('/var/www/nrka/tests/application/bootstrap.php') /usr/share/php/PHPUnit/Util/Fileloader.php:117
0.2773 7249284 7. Doctrine_Cli->run() /var/www/nrka/tests/application/bootstrap.php:33
0.2773 7249348 8. Doctrine_Cli->_run() /var/www/nrka/library/Doctrine/Cli.php:452
0.2789 7259336 9. Doctrine_Cli->executeTask() /var/www/nrka/library/Doctrine/Cli.php:498
0.2790 7259480 10. Doctrine_Task_BuildAllReload->execute() /var/www/nrka/library/Doctrine/Cli.php:516
0.5301 11487988 11. Doctrine_Task_LoadData->execute() /var/www/nrka/library/Doctrine/Task/BuildAllReload.php:56
0.5312 11488028 12. Doctrine_Core::loadData() /var/www/nrka/library/Doctrine/Task/LoadData.php:43
0.5324 11527112 13. Doctrine_Data->importData() /var/www/nrka/library/Doctrine/Core.php:996
0.5372 11641772 14. Doctrine_Data_Import->doImport() /var/www/nrka/library/Doctrine/Data.php:222
0.5375 11642232 15. Doctrine_Data->purge() /var/www/nrka/library/Doctrine/Data/Import.php:115
0.5375 11642300 16. Doctrine_Core::getLoadedModels() /var/www/nrka/library/Doctrine/Data.php:263
0.5382 11690076 17. Doctrine_Core::filterInvalidModels() /var/www/nrka/library/Doctrine/Core.php:716
0.5544 11710976 18. Doctrine_Core::isValidModelClass() /var/www/nrka/library/Doctrine/Core.php:763
0.5544 11711084 19. class_exists() /var/www/nrka/library/Doctrine/Core.php:784
0.5546 11711456 20. Doctrine_Core::modelsAutoload() /var/www/nrka/library/Doctrine/Core.php:0
What I think that is happening is that the autoloaders of zend Framework, Doctrine and PHPunit are disturbing each other but I am not sure about it.
Btw. Line 19 of the above file (addresses.ph) is the last line of that file. I have checked other locations wether it's manually included somewhere else but as far as I can see it isn't
This is how my application.ini looks like:
production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "Europe/Amsterdam"
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutpath = APPLICATION_PATH "/layouts"
resources.view.basePath = /var/www/nrka/public/
autoloaderNamespaces[] = "Doctrine"
autoloaderNamespaces0 = "JS_"
;---------
;databases
;---------
doctrine.dsn = "mysql://root:root@localhost/zcdev"
doctrine.data_fixtures_path = APPLICATION_PATH "/configs/data/fixtures"
doctrine.sql_path = APPLICATION_PATH "/configs/data/sql"
doctrine.migrations_path = APPLICATION_PATH "/configs/migrations"
doctrine.yaml_schema_path = APPLICATION_PATH "/configs/schema.yml"
doctrine.models_path = APPLICATION_PATH "/models"
resources.db.isDefaultTableAdapter = true
resources.db.adapter = mysqli
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password = root
resources.db.params.dbname = ladosa
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
doctrine.dsn = "mysql://root:root@localhost/zctest"
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
It might give some extra info.
So I am curious to know if anyone has a solution for me.
Thanks in advance!