public function testUnitTestLoadFixtures() { Zend_Db_Table_Abstract::setDefaultAdapter($db = new Zend_Db_Adapter_Pdo_Sqlite(array('dbname' => ":memory:"))); $db->getConnection()->exec('DROP TABLE IF EXISTS `foo`; CREATE TABLE `foo` (`a` VARCHAR, `b` VARCHAR);'); $suite = new PHPUnit_Framework_TestSuite(); $suite->addTestSuite('NotEmptyZendDbTest'); $suite->run($result = new PHPUnit_Framework_TestResult()); $this->assertEquals(1, $result->count()); $this->assertTestsAreSuccessful($result); }
private function connectDB() { try { $dbconfig = array('host' => $this->config->database->host, 'username' => $this->config->database->username, 'password' => $this->config->database->password, 'dbname' => $this->config->database->db); $dbconfig = $this->doQoolHook('front_pre_connectdb', $dbconfig); //here we check for database type switch ($this->config->database->type) { case "mysql": $db = new Zend_Db_Adapter_Pdo_Mysql($dbconfig); $db->getConnection(); $db->setFetchMode(Zend_Db::FETCH_ASSOC); $smt = $db->query("SET NAMES 'utf8'"); $smt->execute(); break; case "sqlite": $db = new Zend_Db_Adapter_Pdo_Sqlite($dbconfig); $db->getConnection(); $db->setFetchMode(Zend_Db::FETCH_ASSOC); break; default: $db = new Zend_Db_Adapter_Pdo_Mysql($dbconfig); $db->getConnection(); $db->setFetchMode(Zend_Db::FETCH_ASSOC); $smt = $db->query("SET NAMES 'utf8'"); $smt->execute(); } } catch (Zend_Db_Adapter_Exception $e) { $this->triggerError($this->language['db_connect_error']); } catch (Zend_Exception $e) { $this->triggerError($this->language['db_factory_error']); } $db = $this->doQoolHook('front_after_connectdb', $db); $this->db = $db; }