/** * 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 a new task can be created. * * @dataProvider provideArgumentsForTaskCreation() * * @param string $commandline * @param int|null $priority * @param int $expectedPriority */ public function testCreatingNewTask($commandline, $priority, $expectedPriority) { $entityManager = $this->createMock(EntityManagerInterface::class); $entityManager->expects($this->once())->method('persist'); $entityManager->expects($this->once())->method('flush'); $taskManager = new TaskManager($entityManager); $task = $taskManager->newTask($commandline, $priority); $this->assertInstanceOf(Task::class, $task); $this->assertSame($commandline, $task->getEntity()->getCommandline()); $this->assertSame($expectedPriority, $task->getEntity()->getPriority()); }