I have following error after running some 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 from ZF documentation:
class BugsTest extends Zend_Test_PHPUnit_DatabaseTestCase
{
private $_connectionMock;
/**
* Returns the test database connection.
*
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
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;
}
/**
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
*/
protected function getDataSet()
{
return $this->createFlatXmlDataSet(
dirname(__FILE__) . '/_files/bugsSeed.xml'
);
}
}
My "fix" for the problem was to not to impelemt PHPUnit_Extensions_Database_DB_IMetaData in Zend_Test_PHPUnit_Db_Metadata_Generic library. Now everything runs ok but I wonder if there is any proper way to resolve this problem.
I'm using ZF 11.11, phpUnit 3.6.10 and DbUnit 1.1.2.
Zend 1.11 doesn't support PHPUnit 3.6, you need to downgrade do PHPUnit 3.5 or 3.4.
Try to uninstall and re-install PHPUnit and his dependencies in the specific order as shown in http://dustyreagan.com/downgrade-phpunit-3-6-to-3-5-15/
Also, see http://framework.zend.com/issues/browse/ZF-11781
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With