Zend Framework, phpunit ve Doktrin sorunlara neden

0 Cevap php

Öncelikle bazı temel bilgiler:

  • Ubuntu son sürüm
  • Zend Çatısı 1.9.6
  • Doktrin 1.2.1
  • Php ünitesi en son sürümü

I this aşağıdaki ve this öğretici doktrin ve phpunit benim zend envrionment kurmak olmuştur.

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.

Bu alıyorum hatadır:

    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

Ne ki oluyor düşünüyorum Zend Framework autoloaders, Doktrin ve phpunit birbirini rahatsız ama ben bu konuda emin değilim olmasıdır.

Btw. Yukarıdaki dosyanın (addresses.ph) Line 19 o dosyanın son satırı. Elle başka bir yere dahil oluyor wether diğer yerlerde kontrol ettiniz ama bildiğim kadarıyla gördüğünüz gibi değil

Bu benim application.ini benziyor nasıl:

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

Bazı ekstra bilgi verebilir.

Yani herkes benim için bir çözüm olup olmadığını merak duyuyorum.

Şimdiden teşekkürler!

0 Cevap