getMock('Zend_Test_DbAdapter'); $testAdapter->expects($this->any()) ->method('delete') ->will($this->throwException(new Exception)); $connection = new Zend_Test_PHPUnit_Db_Connection($testAdapter, "schema"); $databaseTester = new Zend_Test_PHPUnit_Db_SimpleTester($connection); $this->assertSame($connection, $databaseTester->getConnection()); } public function testSetupDatabase() { $testAdapter = $this->getMock('Zend_Test_DbAdapter'); $testAdapter->expects($this->any()) ->method('delete') ->will($this->throwException(new Exception)); $connection = new Zend_Test_PHPUnit_Db_Connection($testAdapter, "schema"); $databaseTester = new Zend_Test_PHPUnit_Db_SimpleTester($connection); $dataSet = $this->getMock('PHPUnit_Extensions_Database_DataSet_IDataSet'); $dataSet->expects($this->any()) ->method('getIterator') ->will($this->returnValue($this->getMock('Iterator'))); $dataSet->expects($this->any()) ->method('getReverseIterator') ->will($this->returnValue($this->getMock('Iterator'))); $databaseTester->setUpDatabase($dataSet); } public function testInvalidConnectionGivenThrowsException() { $this->setExpectedException("Zend_Test_PHPUnit_Db_Exception"); $connection = $this->getMock('PHPUnit_Extensions_Database_DB_IDatabaseConnection'); $databaseTester = new Zend_Test_PHPUnit_Db_SimpleTester($connection); } }