2017-03-31 17:24:00 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace JKingWeb\Arsse\Test\Database;
|
|
|
|
use JKingWeb\Arsse\Data;
|
|
|
|
use JKingWeb\Arsse\Db\SQLite3\Driver;
|
|
|
|
|
|
|
|
trait DriverSQLite3 {
|
|
|
|
function setUpDriver() {
|
2017-05-22 14:02:36 +00:00
|
|
|
if(!extension_loaded("sqlite3")) {
|
|
|
|
$this->markTestSkipped("SQLite extension not loaded");
|
|
|
|
}
|
2017-03-31 17:24:00 +00:00
|
|
|
Data::$conf->dbSQLite3File = ":memory:";
|
|
|
|
$this->drv = new Driver(true);
|
|
|
|
}
|
2017-05-11 01:21:23 +00:00
|
|
|
|
|
|
|
function nextID(string $table): int {
|
|
|
|
return $this->drv->query("SELECT (case when max(id) then max(id) else 0 end)+1 from $table")->getValue();
|
|
|
|
}
|
2017-03-31 17:24:00 +00:00
|
|
|
}
|