protected function getConnection($connect = true) { $dsn = Zibo::getInstance()->getConfigValue('database.connection.mysql'); if ($dsn == null) { Reflection::setProperty(Zibo::getInstance(), 'instance', null); $this->markTestSkipped('No dsn found for database.connection.mysql, check config/database.ini'); return; } $this->dsn = new Dsn($dsn); $connection = new MysqlDriver($this->dsn); if ($connect) { $connection->connect(); } return $connection; }
/** * @expectedException zibo\library\database\exception\DatabaseException */ public function testConnectThrowsExceptionWhenConnectionNotConnectable() { $connection = new MysqlDriver(new Dsn('mysql://localhost/unexistant')); $connection->connect(); }