1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 09:02:41 +00:00
Arsse/tests/cases/Database/SeriesMiscellany.php

58 lines
1.8 KiB
PHP
Raw Permalink 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);
2021-04-14 15:17:01 +00:00
2018-11-23 15:01:17 +00:00
namespace JKingWeb\Arsse\TestCase\Database;
2017-08-29 14:50:31 +00:00
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Database;
trait SeriesMiscellany {
2020-01-20 18:52:48 +00:00
protected function setUpSeriesMiscellany(): void {
2018-11-25 05:03:56 +00:00
static::setConf([
'dbDriver' => static::$dbDriverClass,
2018-11-25 05:03:56 +00:00
]);
}
2020-01-20 18:52:48 +00:00
protected function tearDownSeriesMiscellany(): void {
2018-11-25 05:03:56 +00:00
}
/**
* @covers \JKingWeb\Arsse\Database::__construct
* @covers \JKingWeb\Arsse\Database::driverSchemaVersion
* @covers \JKingWeb\Arsse\Database::driverSchemaUpdate
*/
2020-01-20 18:52:48 +00:00
public function testInitializeDatabase(): void {
static::dbRaze(static::$drv);
2018-12-05 17:54:19 +00:00
$d = new Database(true);
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
}
/**
* @covers \JKingWeb\Arsse\Database::__construct
* @covers \JKingWeb\Arsse\Database::driverSchemaVersion
* @covers \JKingWeb\Arsse\Database::driverSchemaUpdate
*/
2020-01-20 18:52:48 +00:00
public function testManuallyInitializeDatabase(): void {
static::dbRaze(static::$drv);
$d = new Database(false);
$this->assertSame(0, $d->driverSchemaVersion());
$this->assertTrue($d->driverSchemaUpdate());
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
$this->assertFalse($d->driverSchemaUpdate());
}
/** @covers \JKingWeb\Arsse\Database::driverCharsetAcceptable */
2020-01-20 18:52:48 +00:00
public function testCheckCharacterSetAcceptability(): void {
2019-10-16 18:42:43 +00:00
$this->assertIsBool(Arsse::$db->driverCharsetAcceptable());
}
2019-07-26 13:37:51 +00:00
/** @covers \JKingWeb\Arsse\Database::driverMaintenance */
2020-01-20 18:52:48 +00:00
public function testPerformMaintenance(): void {
2019-07-26 13:37:51 +00:00
$this->assertTrue(Arsse::$db->driverMaintenance());
}
2017-08-29 14:50:31 +00:00
}