diff --git a/lib/SP/Infrastructure/Plugin/Repositories/PluginData.php b/lib/SP/Infrastructure/Plugin/Repositories/PluginData.php index c6ad1c67..86f996d4 100644 --- a/lib/SP/Infrastructure/Plugin/Repositories/PluginData.php +++ b/lib/SP/Infrastructure/Plugin/Repositories/PluginData.php @@ -184,6 +184,10 @@ final class PluginData extends BaseRepository implements PluginDataRepository */ public function getByNameBatch(array $names): QueryResult { + if (count($names) === 0) { + return new QueryResult(); + } + $query = $this->queryFactory ->newSelect() ->from(self::TABLE) diff --git a/tests/SPT/Infrastructure/Plugin/Repositories/PluginDataTest.php b/tests/SPT/Infrastructure/Plugin/Repositories/PluginDataTest.php index a1eb1eb0..6916f206 100644 --- a/tests/SPT/Infrastructure/Plugin/Repositories/PluginDataTest.php +++ b/tests/SPT/Infrastructure/Plugin/Repositories/PluginDataTest.php @@ -213,6 +213,15 @@ class PluginDataTest extends UnitaryTestCase $this->pluginData->getByNameBatch($names); } + public function testGetByNameBatchWithNoNames() + { + $this->database + ->expects(self::never()) + ->method('doSelect'); + + $this->pluginData->getByNameBatch([]); + } + /** * @throws ConstraintException * @throws QueryException @@ -244,6 +253,19 @@ class PluginDataTest extends UnitaryTestCase $this->pluginData->deleteByNameBatch($names); } + /** + * @throws ConstraintException + * @throws QueryException + */ + public function testDeleteByNameBatchWithNoNames() + { + $this->database + ->expects(self::never()) + ->method('doQuery'); + + $this->pluginData->deleteByNameBatch([]); + } + public function testGetByItemId() { $callback = new Callback(