1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-25 01:52:40 +00:00
Arsse/tests/lib/Database/DriverSQLite3.php

25 lines
691 B
PHP
Raw Normal View History

<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
2017-08-29 14:50:31 +00:00
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Db\SQLite3\Driver;
trait DriverSQLite3 {
2017-08-29 14:50:31 +00:00
public function setUpDriver() {
2017-12-22 16:45:24 +00:00
if (!Driver::requirementsMet()) {
$this->markTestSkipped("SQLite extension not loaded");
}
Arsse::$conf->dbSQLite3File = ":memory:";
$this->drv = new Driver();
}
2017-08-29 14:50:31 +00:00
public 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-08-29 14:50:31 +00:00
}