Exemplo n.º 1
0
 /**
  * @param string      $cmd
  * @param string|null $workingDirectory
  * @param bool        $isDryRun
  * @param bool        $tty
  * @return $this
  */
 public function add($cmd, $workingDirectory, $isDryRun = false, $tty = false)
 {
     $process = null;
     if (!$isDryRun) {
         $process = new Process($cmd);
         $process->setTty($tty);
         $process->setWorkingDirectory($workingDirectory);
         $this->parallelProcessRunner->add($process);
     }
     return $this;
 }
 /**
  * @param array  $processes
  * @param string $hookedEventName
  *
  * @return ProcessEvent[]
  */
 protected function hookEventsByName(array $processes, $hookedEventName)
 {
     $events = [];
     $eventDispatcher = $this->getMock(EventDispatcher::class, ['dispatch']);
     $eventDispatcher->expects($this->any())->method('dispatch')->willReturnCallback(function ($evenName, $event) use(&$events, $hookedEventName) {
         if ($hookedEventName == $evenName) {
             $events[] = $event;
         }
     });
     $runner = new ParallelProcessRunner($eventDispatcher);
     $runner->add($processes)->run();
     return $events;
 }