2017-07-23 03:08:08 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace JKingWeb\Arsse\Test\Database;
|
2017-08-29 14:50:31 +00:00
|
|
|
|
2017-07-23 03:08:08 +00:00
|
|
|
use JKingWeb\Arsse\Arsse;
|
|
|
|
use JKingWeb\Arsse\Database;
|
|
|
|
|
|
|
|
trait SeriesMiscellany {
|
2017-08-29 14:50:31 +00:00
|
|
|
public function testListDrivers() {
|
2017-07-23 03:08:08 +00:00
|
|
|
$exp = [
|
|
|
|
'JKingWeb\\Arsse\\Db\\SQLite3\\Driver' => Arsse::$lang->msg("Driver.Db.SQLite3.Name"),
|
|
|
|
];
|
|
|
|
$this->assertArraySubset($exp, Database::driverList());
|
|
|
|
}
|
|
|
|
|
2017-08-29 14:50:31 +00:00
|
|
|
public function testInitializeDatabase() {
|
2017-07-23 03:08:08 +00:00
|
|
|
$d = new Database();
|
|
|
|
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
|
|
|
|
}
|
|
|
|
|
2017-08-29 14:50:31 +00:00
|
|
|
public function testManuallyInitializeDatabase() {
|
2017-07-23 03:08:08 +00:00
|
|
|
$d = new Database(false);
|
|
|
|
$this->assertSame(0, $d->driverSchemaVersion());
|
|
|
|
$this->assertTrue($d->driverSchemaUpdate());
|
|
|
|
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
|
|
|
|
$this->assertFalse($d->driverSchemaUpdate());
|
|
|
|
}
|
2017-08-29 14:50:31 +00:00
|
|
|
}
|