예제 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $commander = $this->getCommander()->initialize();
     $taskManager = $commander->getTaskManager();
     $logger = $commander->getLogger();
     $taskRunner = new TaskRunner($taskManager, $output, $logger);
     $taskRunner->runAll($this->getConfiguration()->getProcessTimeout());
 }
예제 #2
0
 /**
  * Test that the task runner runs all tasks in quiet mode.
  */
 public function testTaskRunnerRunsAllTasksInQuietMode()
 {
     $connection = $this->createMock(Connection::class);
     $entityManager = $this->createMock(EntityManagerInterface::class);
     $entityManager->expects($this->any())->method('getConnection')->will($this->returnValue($connection));
     $entityOne = new TaskEntity();
     if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
         $entityOne->setCommandline('dir');
     } else {
         $entityOne->setCommandline('ls -l');
     }
     $entityTwo = new TaskEntity();
     $entityTwo->setCommandline('foobarbaz');
     $taskManager = $this->createMock(TaskManager::class);
     $taskManager->expects($this->exactly(3))->method('findNextTask')->will($this->onConsecutiveCalls(new Task($entityManager, $entityOne), new Task($entityManager, $entityTwo), null));
     $output = $this->createMock(OutputInterface::class);
     $output->expects($this->atLeastOnce())->method('isQuiet')->will($this->returnValue(true));
     $logger = $this->createMock(LoggerInterface::class);
     $logger->expects($this->atLeastOnce())->method('log');
     $taskRunner = new TaskRunner($taskManager, $output, $logger);
     $taskRunner->runAll(60);
     $this->assertInternalType('integer', $entityOne->getPid());
     $this->assertEquals(0, $entityOne->getExitCode());
 }