Esempio n. 1
0
 /**
  * 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);
     }
 }
Esempio n. 2
0
 /**
  * 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());
 }