feat(taskprocessing): fix phpunit tests

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
pull/54272/head
Julien Veyssier 2025-08-06 18:21:27 +07:00
parent 10921c05b7
commit 0dc93bc320
No known key found for this signature in database
GPG Key ID: 4141FEE162030638
1 changed files with 24 additions and 6 deletions

@ -943,11 +943,6 @@ class TaskProcessingTest extends \Test\TestCase {
$timeFactory->expects($this->any())->method('getDateTime')->willReturnCallback(fn () => $currentTime);
$timeFactory->expects($this->any())->method('getTime')->willReturnCallback(fn () => $currentTime->getTimestamp());
$this->taskMapper = new TaskMapper(
Server::get(IDBConnection::class),
$timeFactory,
);
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
new ServiceRegistration('test', SuccessfulSyncProvider::class)
]);
@ -968,11 +963,34 @@ class TaskProcessingTest extends \Test\TestCase {
$task = $this->manager->getTask($task->getId());
$taskMapper = new TaskMapper(
Server::get(IDBConnection::class),
$timeFactory,
);
$manager = new Manager(
$this->appConfig,
$this->coordinator,
$this->serverContainer,
Server::get(LoggerInterface::class),
$taskMapper,
$this->jobList,
Server::get(IEventDispatcher::class),
Server::get(IAppDataFactory::class),
Server::get(IRootFolder::class),
Server::get(\OC\TextToImage\Manager::class),
$this->userMountCache,
Server::get(IClientService::class),
Server::get(IAppManager::class),
Server::get(IUserManager::class),
Server::get(IUserSession::class),
Server::get(ICacheFactory::class),
);
$currentTime = $currentTime->add(new \DateInterval('P1Y'));
// run background job
$bgJob = new RemoveOldTasksBackgroundJob(
$timeFactory,
$this->manager,
// use a locally defined manager to make sure the taskMapper uses the mocked timeFactory
$manager,
);
$bgJob->setArgument([]);
$bgJob->start($this->jobList);