/** * * @return Status */ public function checkPrerequisites() { $result = Status::newGood(); // Bail out if SQLite is too old $db = DatabaseSqlite::newStandaloneInstance(':memory:'); if (version_compare($db->getServerVersion(), self::MINIMUM_VERSION, '<')) { $result->fatal('config-outdated-sqlite', $db->getServerVersion(), self::MINIMUM_VERSION); } // Check for FTS3 full-text search module if (DatabaseSqlite::getFulltextSearchModule() != 'FTS3') { $result->warning('config-no-fts3'); } return $result; }
public function testToString() { $db = DatabaseSqlite::newStandaloneInstance(':memory:'); $toString = (string) $db; $this->assertContains('SQLite ', $toString); }
/** * @covers DatabaseSqlite::numFields */ public function testNumFields() { $db = DatabaseSqlite::newStandaloneInstance(':memory:'); $databaseCreation = $db->query('CREATE TABLE a ( a_1 )', __METHOD__); $this->assertInstanceOf('ResultWrapper', $databaseCreation, "Failed to create table a"); $res = $db->select('a', '*'); $this->assertEquals(0, $db->numFields($res), "expects to get 0 fields for an empty table"); $insertion = $db->insert('a', array('a_1' => 10), __METHOD__); $this->assertTrue($insertion, "Insertion failed"); $res = $db->select('a', '*'); $this->assertEquals(1, $db->numFields($res), "wrong number of fields"); $this->assertTrue($db->close(), "closing database"); }