diff --git a/lib/Db/MySQL/Driver.php b/lib/Db/MySQL/Driver.php index 69c16505..dba104fc 100644 --- a/lib/Db/MySQL/Driver.php +++ b/lib/Db/MySQL/Driver.php @@ -40,6 +40,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { $db = Arsse::$conf->dbMySQLDb ?? "arsse"; $this->makeConnection($user, $pass, $db, $host, $port, $socket ?? ""); $this->exec("SET lock_wait_timeout = 1"); + $this->exec("SET time_zone = '+00:00'"); } /** @codeCoverageIgnore */ diff --git a/tests/cases/Db/MySQLPDO/TestDatabase.php b/tests/cases/Db/MySQLPDO/TestDatabase.php new file mode 100644 index 00000000..0758364b --- /dev/null +++ b/tests/cases/Db/MySQLPDO/TestDatabase.php @@ -0,0 +1,21 @@ + + * @covers \JKingWeb\Arsse\Misc\Query + */ +class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\Base { + protected static $implementation = "PDO MySQL"; + + protected function nextID(string $table): int { + return (int) (static::$drv->query("SELECT auto_increment from information_schema.tables where table_name = '$table'")->getValue() ?? 1); + } +} diff --git a/tests/lib/DatabaseInformation.php b/tests/lib/DatabaseInformation.php index 0350362f..28a342fd 100644 --- a/tests/lib/DatabaseInformation.php +++ b/tests/lib/DatabaseInformation.php @@ -186,6 +186,7 @@ class DatabaseInformation { } else { $db->query("DELETE FROM $table"); } + $db->query("ALTER TABLE $table auto_increment = 1"); } foreach ($afterStatements as $st) { $db->query($st); diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 3410ac82..6fa69da2 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -80,6 +80,7 @@ cases/Db/SQLite3PDO/TestDatabase.php cases/Db/PostgreSQL/TestDatabase.php cases/Db/PostgreSQLPDO/TestDatabase.php + cases/Db/MySQLPDO/TestDatabase.php cases/REST/TestTarget.php