Page MenuHomePhabricator

PDOSqliteTest.php
No OneTemporary

PDOSqliteTest.php

<?php
namespace Sabre\CardDAV\Backend;
require_once 'Sabre/TestUtil.php';
class PDOSqliteTest extends AbstractPDOTest {
function tearDown() {
if (file_exists(SABRE_TEMPDIR . '/pdobackend')) unlink(SABRE_TEMPDIR . '/pdobackend');
if (file_exists(SABRE_TEMPDIR . '/pdobackend2')) unlink(SABRE_TEMPDIR . '/pdobackend2');
}
/**
* @return PDO
*/
function getPDO() {
if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
$pdo = new \PDO('sqlite:'.SABRE_TEMPDIR.'/pdobackend');
$pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION);
$pdo->query("DROP TABLE IF EXISTS addressbooks");
$pdo->query("DROP TABLE IF EXISTS addressbookchanges");
$pdo->query("DROP TABLE IF EXISTS cards");
$queries = explode(
';',
file_get_contents(__DIR__ . '/../../../../examples/sql/sqlite.addressbooks.sql')
);
foreach($queries as $query) {
$query = trim($query," \r\n\t");
if ($query)
$pdo->exec($query);
}
return $pdo;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Dec 21, 11:04 AM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914169
Default Alt Text
PDOSqliteTest.php (1 KB)

Event Timeline