2017-07-22 23:08:08 -04:00
|
|
|
<?php
|
2017-11-16 20:23:18 -05:00
|
|
|
/** @license MIT
|
|
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
|
2017-07-22 23:08:08 -04:00
|
|
|
declare(strict_types=1);
|
2021-04-14 11:17:01 -04:00
|
|
|
|
2018-11-23 10:01:17 -05:00
|
|
|
namespace JKingWeb\Arsse\TestCase\Database;
|
2017-08-29 10:50:31 -04:00
|
|
|
|
2017-07-22 23:08:08 -04:00
|
|
|
use JKingWeb\Arsse\Arsse;
|
|
|
|
use JKingWeb\Arsse\Database;
|
|
|
|
|
|
|
|
trait SeriesMiscellany {
|
2020-01-20 13:52:48 -05:00
|
|
|
protected function setUpSeriesMiscellany(): void {
|
2018-11-25 00:03:56 -05:00
|
|
|
static::setConf([
|
2019-01-12 12:43:06 -05:00
|
|
|
'dbDriver' => static::$dbDriverClass,
|
2018-11-25 00:03:56 -05:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2020-01-20 13:52:48 -05:00
|
|
|
protected function tearDownSeriesMiscellany(): void {
|
2018-11-25 00:03:56 -05:00
|
|
|
}
|
|
|
|
|
2020-01-20 13:52:48 -05:00
|
|
|
public function testInitializeDatabase(): void {
|
2019-01-12 12:43:06 -05:00
|
|
|
static::dbRaze(static::$drv);
|
2018-12-05 12:54:19 -05:00
|
|
|
$d = new Database(true);
|
|
|
|
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
|
2017-07-22 23:08:08 -04:00
|
|
|
}
|
|
|
|
|
2020-01-20 13:52:48 -05:00
|
|
|
public function testManuallyInitializeDatabase(): void {
|
2019-01-12 12:43:06 -05:00
|
|
|
static::dbRaze(static::$drv);
|
2017-07-22 23:08:08 -04: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-11-29 18:14:59 -05:00
|
|
|
|
2020-01-20 13:52:48 -05:00
|
|
|
public function testCheckCharacterSetAcceptability(): void {
|
2019-10-16 14:42:43 -04:00
|
|
|
$this->assertIsBool(Arsse::$db->driverCharsetAcceptable());
|
2017-11-29 18:14:59 -05:00
|
|
|
}
|
2019-07-26 09:37:51 -04:00
|
|
|
|
2020-01-20 13:52:48 -05:00
|
|
|
public function testPerformMaintenance(): void {
|
2019-07-26 09:37:51 -04:00
|
|
|
$this->assertTrue(Arsse::$db->driverMaintenance());
|
|
|
|
}
|
2017-08-29 10:50:31 -04:00
|
|
|
}
|