From fe0261321485df759954f69f78b1a5e18e1ff353 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Fri, 22 Apr 2022 22:46:13 -0400 Subject: [PATCH] Fix coverage --- lib/Database.php | 3 ++- tests/cases/Database/SeriesArticle.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Database.php b/lib/Database.php index cec47f9..40e0e34 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -1682,7 +1682,8 @@ class Database { if ($context->not->$m()) { if ($op === "in") { if (!$context->not->$m) { - throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]); // must have at least one array element + // for exclusions we don't care if the array is empty + continue; } [$inClause, $inTypes, $inValues] = $this->generateIn($context->not->$m, $type); $q->setWhereNot("{$colDefs[$outerCol]} in (select $selection from $cte where $innerCol in($inClause))", $inTypes, $inValues); diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index 2a4aa51..b7d1eb0 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -505,6 +505,8 @@ trait SeriesArticle { 'Folder tree 1 excluding subscription 4' => [(new Context)->not->subscription(4)->folder(1), [5,6]], 'Folder tree 1 excluding articles 7 and 8' => [(new Context)->folder(1)->not->articles([7,8]), [5,6]], 'Folder tree 1 excluding no articles' => [(new Context)->folder(1)->not->articles([]), [5,6,7,8]], + 'Folder tree 1 excluding no labels' => [(new Context)->folder(1)->not->labels([]), [5,6,7,8]], + 'Folder tree 1 excluding no tags' => [(new Context)->folder(1)->not->tags([]), [5,6,7,8]], 'Marked or labelled between 2000 and 2015 excluding in 2010' => [(new Context)->markedRange("2000-01-01T00:00:00Z", "2015-12-31T23:59:59")->not->markedRange("2010-01-01T00:00:00Z", "2010-12-31T23:59:59Z"), [1,3,5,7,8]], 'Search with exclusion' => [(new Context)->searchTerms(["Article"])->not->searchTerms(["one", "two"]), [3]], 'Excluded folder tree' => [(new Context)->not->folder(1), [1,2,3,4,19,20]],