2017-12-19 17:15:05 -05:00
|
|
|
<?php
|
|
|
|
/** @license MIT
|
|
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2017-12-22 11:45:24 -05:00
|
|
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
|
|
|
|
|
2017-12-19 17:15:05 -05:00
|
|
|
/**
|
|
|
|
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
|
|
|
|
* @covers \JKingWeb\Arsse\Db\PDODriver
|
2019-01-15 08:58:11 -05:00
|
|
|
* @covers \JKingWeb\Arsse\Db\PDOError
|
|
|
|
* @covers \JKingWeb\Arsse\Db\SQLState */
|
2018-11-22 13:55:57 -05:00
|
|
|
class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
|
2019-01-12 12:43:06 -05:00
|
|
|
use \JKingWeb\Arsse\TestCase\DatabaseDrivers\SQLite3PDO;
|
|
|
|
|
2018-11-22 13:55:57 -05:00
|
|
|
protected $create = "CREATE TABLE arsse_test(id integer primary key)";
|
|
|
|
protected $lock = "BEGIN EXCLUSIVE TRANSACTION";
|
|
|
|
protected $setVersion = "PRAGMA user_version=#";
|
|
|
|
protected static $file;
|
2017-12-19 17:15:05 -05:00
|
|
|
|
2018-11-22 13:55:57 -05:00
|
|
|
public static function setUpBeforeClass() {
|
2018-11-27 14:26:33 -05:00
|
|
|
// create a temporary database file rather than using a memory database
|
|
|
|
// some tests require one connection to block another, so a memory database is not suitable
|
|
|
|
static::$file = tempnam(sys_get_temp_dir(), 'ook');
|
|
|
|
static::$conf['dbSQLite3File'] = static::$file;
|
|
|
|
parent::setUpBeforeclass();
|
2017-12-19 17:15:05 -05:00
|
|
|
}
|
|
|
|
|
2018-11-22 13:55:57 -05:00
|
|
|
public static function tearDownAfterClass() {
|
2018-11-27 14:26:33 -05:00
|
|
|
parent::tearDownAfterClass();
|
2018-11-22 13:55:57 -05:00
|
|
|
@unlink(self::$file);
|
|
|
|
self::$file = null;
|
2017-12-19 17:15:05 -05:00
|
|
|
}
|
|
|
|
}
|