@@ -943,11 +943,6 @@ public function testOldTasksShouldBeCleanedUp(): void {
943943 $ timeFactory ->expects ($ this ->any ())->method ('getDateTime ' )->willReturnCallback (fn () => $ currentTime );
944944 $ timeFactory ->expects ($ this ->any ())->method ('getTime ' )->willReturnCallback (fn () => $ currentTime ->getTimestamp ());
945945
946- $ this ->taskMapper = new TaskMapper (
947- Server::get (IDBConnection::class),
948- $ timeFactory ,
949- );
950-
951946 $ this ->registrationContext ->expects ($ this ->any ())->method ('getTaskProcessingProviders ' )->willReturn ([
952947 new ServiceRegistration ('test ' , SuccessfulSyncProvider::class)
953948 ]);
@@ -968,11 +963,34 @@ public function testOldTasksShouldBeCleanedUp(): void {
968963
969964 $ task = $ this ->manager ->getTask ($ task ->getId ());
970965
966+ $ taskMapper = new TaskMapper (
967+ Server::get (IDBConnection::class),
968+ $ timeFactory ,
969+ );
970+ $ manager = new Manager (
971+ $ this ->appConfig ,
972+ $ this ->coordinator ,
973+ $ this ->serverContainer ,
974+ Server::get (LoggerInterface::class),
975+ $ taskMapper ,
976+ $ this ->jobList ,
977+ Server::get (IEventDispatcher::class),
978+ Server::get (IAppDataFactory::class),
979+ Server::get (IRootFolder::class),
980+ Server::get (\OC \TextToImage \Manager::class),
981+ $ this ->userMountCache ,
982+ Server::get (IClientService::class),
983+ Server::get (IAppManager::class),
984+ Server::get (IUserManager::class),
985+ Server::get (IUserSession::class),
986+ Server::get (ICacheFactory::class),
987+ );
971988 $ currentTime = $ currentTime ->add (new \DateInterval ('P1Y ' ));
972989 // run background job
973990 $ bgJob = new RemoveOldTasksBackgroundJob (
974991 $ timeFactory ,
975- $ this ->manager ,
992+ // use a locally defined manager to make sure the taskMapper uses the mocked timeFactory
993+ $ manager ,
976994 );
977995 $ bgJob ->setArgument ([]);
978996 $ bgJob ->start ($ this ->jobList );
0 commit comments