1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Correct spuriously failing tests

This commit is contained in:
J. King 2019-08-05 16:33:48 -04:00
parent e76871c567
commit b8b559b0f8
3 changed files with 3 additions and 3 deletions

View file

@ -415,7 +415,7 @@ trait SeriesArticle {
/** @dataProvider provideContextMatches */ /** @dataProvider provideContextMatches */
public function testListArticlesCheckingContext(Context $c, array $exp) { 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($ids);
sort($exp); sort($exp);
$this->assertEquals($exp, $ids); $this->assertEquals($exp, $ids);

View file

@ -16,6 +16,6 @@ class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\Base {
use \JKingWeb\Arsse\TestCase\DatabaseDrivers\MySQL; use \JKingWeb\Arsse\TestCase\DatabaseDrivers\MySQL;
protected function nextID(string $table): int { 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);
} }
} }

View file

@ -17,6 +17,6 @@ class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\Base {
use \JKingWeb\Arsse\TestCase\DatabaseDrivers\MySQLPDO; use \JKingWeb\Arsse\TestCase\DatabaseDrivers\MySQLPDO;
protected function nextID(string $table): int { 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);
} }
} }