_setUpTestUtil(); $this->_setUpAdapter(); $this->_util->setUp($this->_db); } /** * Get a TestUtil class for the current RDBMS brand. */ protected function _setUpTestUtil() { $driver = $this->getDriver(); $utilClass = "Zend_Db_TestUtil_{$driver}"; Zend_Loader::loadClass($utilClass); $this->_util = new $utilClass(); } /** * Open a new database connection */ protected function _setUpAdapter() { $this->_db = Zend_Db::factory($this->getDriver(), $this->_util->getParams()); try { $conn = $this->_db->getConnection(); } catch (Zend_Exception $e) { $this->_db = null; $this->assertType('Zend_Db_Adapter_Exception', $e, 'Expecting Zend_Db_Adapter_Exception, got ' . get_class($e)); $this->markTestSkipped($e->getMessage()); } } /** * Subclasses should call parent::tearDown() after * doing their own logic, e.g. deleting metadata. */ public function tearDown() { $this->_util->tearDown(); $this->_db = null; } }