I have the following error after starting a basic database test in Zend Framework with phpUnit
PHP Fatal error: Class Zend_Test_PHPUnit_Db_Metadata_Generic contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPUnit_Extensions_Database_DB_IMetaData::disablePrimaryKeys, PHPUnit_Extensions_Database_DB_IMetaData::enablePrimaryKeys) in D:\www\~library\zend_latest\library\Zend\Test\PHPUnit\Db\Metadata\Generic.php on line 167
My test is very similar to one of the ZF documentation:
class BugsTest extends Zend_Test_PHPUnit_DatabaseTestCase
{
private $_connectionMock;
protected function getConnection()
{
if($this->_connectionMock == null) {
$connection = Zend_Db::factory(...);
$this->_connectionMock = $this->createZendDbConnection(
$connection, 'zfunittests'
);
Zend_Db_Table_Abstract::setDefaultAdapter($connection);
}
return $this->_connectionMock;
}
protected function getDataSet()
{
return $this->createFlatXmlDataSet(
dirname(__FILE__) . '/_files/bugsSeed.xml'
);
}
}
My "fix" for the problem was to not impelemt PHPUnit_Extensions_Database_DB_IMetaDatain the library Zend_Test_PHPUnit_Db_Metadata_Generic. Now everything is working fine, but I'm wondering if there is a suitable way to solve this problem.
I am using ZF 11.11, phpUnit 3.6.10 and DbUnit 1.1.2.
source
share