/** * Run all tasks from the task manager. * * @param int $timeout * * @return void */ public function runAll($timeout) { while (null !== ($task = $this->taskManager->findNextTask())) { $this->run($task, $timeout); } }
/** * Test that the next task can be null when it can not be found. */ public function testFindingNextTaskReturnsNull() { $repository = $this->createMock(TaskEntityRepository::class); $repository->expects($this->once())->method('findNext')->will($this->returnValue(null)); $entityManager = $this->createMock(EntityManagerInterface::class); $entityManager->expects($this->once())->method('getRepository')->with(TaskEntity::class)->will($this->returnValue($repository)); $taskManager = new TaskManager($entityManager); $this->assertNull($taskManager->findNextTask()); }