ZF-8087: Error within unit testing with PHPUnit - Zend_Db_Table_Exception: No adapter found for [...]
Description
I am using TDD with Zend Framework.
I've set up tests for every component of my application. Within testing, I am using an SQLite database that replaces the live database.
With 1.8.4, all went well.
With 1.9, I am getting random errors during testing, for example the following:
7) ModelTechnologyMapperTest::testFetchAll Zend_Db_Table_Exception: No adapter found for Default_Model_DbTable_Technologies
/Users/skiller/PHP Projects/skiller/library/Zend/Db/Table/Abstract.php:754 /Users/skiller/PHP Projects/skiller/library/Zend/Db/Table/Abstract.php:739 /Users/skiller/PHP Projects/skiller/library/Zend/Db/Table/Abstract.php:268 /Users/skiller/PHP Projects/skiller/application/models/TechnologyMapper.php:17 /Users/skiller/PHP Projects/skiller/application/models/TechnologyMapper.php:32 /Users/skiller/PHP Projects/skiller/application/models/TechnologyMapper.php:52 /Users/skiller/PHP Projects/skiller/tests/application/models/TechnologyMapperTest.php:86
The strange thing is that other tests for model classes in the same test suite don't yield such errors although they share the exact same database and configuration parameters.
Since some tests work and some don't, I suspect a problem with the correct initiation sequence within the extended ZF/PHPUnit framework.
Comments
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-10-17T12:29:02.000+0000
Could you please provide any code with which we can reproduce this problem?
Posted by Constantin Ehrenstein (skiller) on 2009-10-17T12:57:35.000+0000
(I hope this is rendered readably by JIRA)
phpunit.xml (in tests/):
in application.ini:
in tests/TechnologyMapperTest.php
in application/models/TechnologyMapper.php:
in application/models/DbTable/Technologies.php:
Posted by Constantin Ehrenstein (skiller) on 2009-10-17T13:01:47.000+0000
tests/application/ControllerTestCase.php:
Oh, and the tests/application/bootstrap.php file for unit testing:
Posted by Ramon Henrique Ornelas (ramon) on 2010-07-01T10:27:58.000+0000
@Constantin Ehrenstein
In class ModelTechnologyMapperTest (tests/TechnologyMapperTest.php). Missing, parent::setUp().