Browse Source

Mostly successful MySQL database function tests

Two failures remain, at least one requiring query munging.
microsub
J. King 5 years ago
parent
commit
24df564045
  1. 1
      lib/Db/MySQL/Driver.php
  2. 21
      tests/cases/Db/MySQLPDO/TestDatabase.php
  3. 1
      tests/lib/DatabaseInformation.php
  4. 1
      tests/phpunit.xml

1
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 */

21
tests/cases/Db/MySQLPDO/TestDatabase.php

@ -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);
}
}

1
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);

1
tests/phpunit.xml

@ -80,6 +80,7 @@
<file>cases/Db/SQLite3PDO/TestDatabase.php</file>
<file>cases/Db/PostgreSQL/TestDatabase.php</file>
<file>cases/Db/PostgreSQLPDO/TestDatabase.php</file>
<file>cases/Db/MySQLPDO/TestDatabase.php</file>
</testsuite>
<testsuite name="REST">
<file>cases/REST/TestTarget.php</file>

Loading…
Cancel
Save