1<?php
2
3namespace Sabre\DAV\Auth\Backend;
4
5require_once 'Sabre/DAV/Auth/Backend/AbstractPDOTest.php';
6
7class PDOSQLiteTest extends AbstractPDOTest {
8
9    function tearDown() {
10
11        if (file_exists(SABRE_TEMPDIR . '/pdobackend')) unlink(SABRE_TEMPDIR . '/pdobackend');
12        if (file_exists(SABRE_TEMPDIR . '/pdobackend2')) unlink(SABRE_TEMPDIR . '/pdobackend2');
13
14    }
15
16    function getPDO() {
17
18        if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
19        $pdo = new \PDO('sqlite:'.SABRE_TEMPDIR.'/pdobackend');
20        $pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION);
21        $pdo->query('CREATE TABLE users (username TEXT, digesta1 TEXT, email VARCHAR(80), displayname VARCHAR(80))');
22        $pdo->query('INSERT INTO users VALUES ("user","hash","user@example.org","User")');
23
24        return $pdo;
25
26    }
27
28}
29