mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-23 09:02:41 +00:00
Mostly successful MySQL database function tests
Two failures remain, at least one requiring query munging.
This commit is contained in:
parent
de07352fd0
commit
24df564045
4 changed files with 24 additions and 0 deletions
|
@ -40,6 +40,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
||||||
$db = Arsse::$conf->dbMySQLDb ?? "arsse";
|
$db = Arsse::$conf->dbMySQLDb ?? "arsse";
|
||||||
$this->makeConnection($user, $pass, $db, $host, $port, $socket ?? "");
|
$this->makeConnection($user, $pass, $db, $host, $port, $socket ?? "");
|
||||||
$this->exec("SET lock_wait_timeout = 1");
|
$this->exec("SET lock_wait_timeout = 1");
|
||||||
|
$this->exec("SET time_zone = '+00:00'");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @codeCoverageIgnore */
|
/** @codeCoverageIgnore */
|
||||||
|
|
21
tests/cases/Db/MySQLPDO/TestDatabase.php
Normal file
21
tests/cases/Db/MySQLPDO/TestDatabase.php
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group slow
|
||||||
|
* @group coverageOptional
|
||||||
|
* @covers \JKingWeb\Arsse\Database<extended>
|
||||||
|
* @covers \JKingWeb\Arsse\Misc\Query<extended>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -186,6 +186,7 @@ class DatabaseInformation {
|
||||||
} else {
|
} else {
|
||||||
$db->query("DELETE FROM $table");
|
$db->query("DELETE FROM $table");
|
||||||
}
|
}
|
||||||
|
$db->query("ALTER TABLE $table auto_increment = 1");
|
||||||
}
|
}
|
||||||
foreach ($afterStatements as $st) {
|
foreach ($afterStatements as $st) {
|
||||||
$db->query($st);
|
$db->query($st);
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
<file>cases/Db/SQLite3PDO/TestDatabase.php</file>
|
<file>cases/Db/SQLite3PDO/TestDatabase.php</file>
|
||||||
<file>cases/Db/PostgreSQL/TestDatabase.php</file>
|
<file>cases/Db/PostgreSQL/TestDatabase.php</file>
|
||||||
<file>cases/Db/PostgreSQLPDO/TestDatabase.php</file>
|
<file>cases/Db/PostgreSQLPDO/TestDatabase.php</file>
|
||||||
|
<file>cases/Db/MySQLPDO/TestDatabase.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="REST">
|
<testsuite name="REST">
|
||||||
<file>cases/REST/TestTarget.php</file>
|
<file>cases/REST/TestTarget.php</file>
|
||||||
|
|
Loading…
Reference in a new issue