1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 09:02:41 +00:00
Arsse/tests/lib/Database/DriverSQLite3.php
J. King ceeb23aea3 More Feed tests: cache header handling
- Also made all SQLite tests skippable if the extension is not loaded
- Fixed format of ETags in test server
- Passed any CLI arguments to PHPUnit in the test runner
2017-05-22 10:02:36 -04:00

19 lines
No EOL
564 B
PHP

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