chore(tests): UT for PluginData repository

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2024-03-10 16:12:05 +01:00
parent 8fb81f9823
commit bbc4e64715
2 changed files with 26 additions and 0 deletions

View File

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

View File

@@ -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(