public function setUp() { \b8\Database::setDetails($this->_name, $this->_user, $this->_pass); \b8\Database::setWriteServers(array($this->_host)); $this->_db = \b8\Database::getConnection('write'); $this->_db->query('DROP TABLE IF EXISTS tres'); $this->_db->query('DROP TABLE IF EXISTS dos'); $this->_db->query('DROP TABLE IF EXISTS uno'); }
public static function setUpBeforeClass() { Database::setDetails('b8_test_' . getenv('PHPCI_BUILD'), 'b8_test', 'b8_test'); Database::setWriteServers(array('localhost')); Database::setReadServers(array('localhost')); Registry::getInstance()->set('b8.app.namespace', 'Generation'); self::$_db = Database::getConnection('write'); self::$_db->query('DROP TABLE IF EXISTS tres'); self::$_db->query('DROP TABLE IF EXISTS dos'); self::$_db->query('DROP TABLE IF EXISTS uno'); self::$_base = dirname(__FILE__) . '/data/generation/'; $gen = new Generator(self::$_db, 'Test', self::$_base . 'models/'); $gen->generate(); }
/** * @expectedException \Exception */ public function testConnectionFailure() { \b8\Database::setDetails('non_existant', 'invalid_user', 'incorrect_password'); \b8\Database::setReadServers(array('localhost')); \b8\Database::getConnection('read'); }