Whats the way to unit test Doctrine 2 models? I am using it with Zend Framework 1.11. It has Zend_Test
which uses PHPUnit. I think the right thing to use is PHPUnit_Extensions_Database_TestCase
. In Zend Framework, I can use Zend_Test_PHPUnit_Db
. How can I modify the code to unit test Doctrine Models instead of Zend_Db
classes.
1st, I think instead of using Zend_Db
stuff, I have to use Doctrine's stuff instead
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;
}
...
}