markTestSkipped( 'The SQLite extension is not available.' ); } } /** * @testdox Valid sqlite connection data result in a valid database connection * @covers phpOMS\DataStorage\Database\Connection\SQLiteConnection * @group framework */ public function testConnect() : void { $sqlite = new SQLiteConnection($GLOBALS['CONFIG']['db']['core']['sqlite']['admin']); $sqlite->connect(); self::assertEquals(DatabaseStatus::OK, $sqlite->getStatus()); self::assertEquals($GLOBALS['CONFIG']['db']['core']['sqlite']['admin']['database'], $sqlite->getDatabase()); self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Grammar\SQLiteGrammar', $sqlite->getGrammar()); self::assertEquals(DatabaseType::SQLITE, $sqlite->getType()); } /** * @testdox A missing database type returns a failure * @covers phpOMS\DataStorage\Database\Connection\SQLiteConnection * @group framework */ public function testInvalidDatabaseType() : void { $db = $GLOBALS['CONFIG']['db']['core']['sqlite']['admin']; unset($db['db']); $sqlite = new SQLiteConnection($db); $sqlite->connect(); self::assertEquals(DatabaseStatus::FAILURE, $sqlite->getStatus()); } /** * @testdox A missing database returns a failure * @covers phpOMS\DataStorage\Database\Connection\SQLiteConnection * @group framework */ public function testInvalidDatabase() : void { $db = $GLOBALS['CONFIG']['db']['core']['sqlite']['admin']; unset($db['database']); $sqlite = new SQLiteConnection($db); $sqlite->connect(); self::assertEquals(DatabaseStatus::FAILURE, $sqlite->getStatus()); } public static function tearDownAfterClass() : void { if (\file_exists($GLOBALS['CONFIG']['db']['core']['sqlite']['admin']['database'])) { \unlink($GLOBALS['CONFIG']['db']['core']['sqlite']['admin']['database']); } } }