public function testQuoteValueWithPdoSqlite() { if (!$this->adapters['pdo_sqlite'] instanceof \PDO) { $this->markTestSkipped('SQLite (PDO_SQLITE) not configured in unit test configuration file'); } $sqlite = new Sqlite($this->adapters['pdo_sqlite']); $value = $sqlite->quoteValue('value'); $this->assertEquals('\'value\'', $value); $sqlite = new Sqlite(new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_sqlite']))); $value = $sqlite->quoteValue('value'); $this->assertEquals('\'value\'', $value); }
/** * @covers Zend\Db\Adapter\Platform\Sqlite::quoteValue * @covers Zend\Db\Adapter\Platform\Sqlite::quoteTrustedValue */ public function testCanCloseConnectionAfterQuoteValue() { // Creating the SQLite database file $filePath = realpath(__DIR__) . "/_files/sqlite.db"; if (!file_exists($filePath)) { touch($filePath); } $driver = new \Zend\Db\Adapter\Driver\Pdo\Pdo(array('driver' => 'Pdo_Sqlite', 'database' => $filePath)); $this->platform->setDriver($driver); $this->platform->quoteValue("some; random]/ value"); $this->platform->quoteTrustedValue("some; random]/ value"); // Closing the connection so we can delete the file $driver->getConnection()->disconnect(); @unlink($filePath); $this->assertFalse(file_exists($filePath)); }
/** * @covers Zend\Db\Adapter\Platform\Sqlite::quoteValue */ public function testQuoteValue() { $this->assertEquals("'value'", $this->platform->quoteValue('value')); }