Exemplo n.º 1
0
 public function invoke()
 {
     parent::invoke();
     $future = new \ExecFuture("composer --no-ansi update");
     $future->start();
     try {
         do {
             list($out) = $future->read();
             echo $out;
         } while (!$future->isReady());
     } catch (\Exception $e) {
         list($err) = $future->read();
         throw new \Exception($err);
     }
 }
Exemplo n.º 2
0
 /**
  * TODO: Replace the code required to spawn the PHPUnit executable
  * with PHPUnit objects.
  *
  */
 public function invoke()
 {
     parent::invoke();
     $this->outputFile = tempnam(null, 'amk.test.json');
     $process = popen($this->getPHPUnitCommand(), 'r');
     // block until PHPUnit has done running
     if ($process) {
         while (!feof($process)) {
             fread($process, 8);
         }
         pclose($process);
     }
     $report = JsonSplitter::split(file_get_contents($this->outputFile));
     foreach ($report as $event) {
         if ('test' != $event->event) {
             continue;
         }
         if ('fail' == $event->status || 'error' == $event->status) {
             $message = "\n{$event->status}\n{$event->message}\n";
             throw new FailedBuildException($message);
         }
     }
     unlink($this->outputFile);
 }