From b8b559b0f895fae242dfb8a1b3334b4ac7d9ec5a Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 5 Aug 2019 16:33:48 -0400 Subject: [PATCH] Correct spuriously failing tests --- tests/cases/Database/SeriesArticle.php | 2 +- tests/cases/Db/MySQL/TestDatabase.php | 2 +- tests/cases/Db/MySQLPDO/TestDatabase.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index 75fba45..c312072 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -415,7 +415,7 @@ trait SeriesArticle { /** @dataProvider provideContextMatches */ public function testListArticlesCheckingContext(Context $c, array $exp) { - $ids = array_column($ids = Arsse::$db->articleList("john.doe@example.com", $c)->getAll(), "id"); + $ids = array_column($ids = Arsse::$db->articleList("john.doe@example.com", $c, ["id"], ["id"])->getAll(), "id"); sort($ids); sort($exp); $this->assertEquals($exp, $ids); diff --git a/tests/cases/Db/MySQL/TestDatabase.php b/tests/cases/Db/MySQL/TestDatabase.php index 81e4cec..4e4f9c5 100644 --- a/tests/cases/Db/MySQL/TestDatabase.php +++ b/tests/cases/Db/MySQL/TestDatabase.php @@ -16,6 +16,6 @@ class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\Base { use \JKingWeb\Arsse\TestCase\DatabaseDrivers\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); + return (int) (static::$drv->query("SELECT (case when max(id) then max(id) else 0 end)+1 from $table")->getValue() ?? 1); } } diff --git a/tests/cases/Db/MySQLPDO/TestDatabase.php b/tests/cases/Db/MySQLPDO/TestDatabase.php index 3af3dcf..6409d12 100644 --- a/tests/cases/Db/MySQLPDO/TestDatabase.php +++ b/tests/cases/Db/MySQLPDO/TestDatabase.php @@ -17,6 +17,6 @@ class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\Base { use \JKingWeb\Arsse\TestCase\DatabaseDrivers\MySQLPDO; protected function nextID(string $table): int { - return (int) (static::$drv->query("SELECT auto_increment from information_schema.tables where table_name = '$table'")->getValue() ?? 1); + return (int) (static::$drv->query("SELECT (case when max(id) then max(id) else 0 end)+1 from $table")->getValue() ?? 1); } }