/** * @expectedException Symfony\Component\Process\Exception\ProcessFailedException */ public function testFailsCommand() { $condition = function () { return true; }; $cmd = 'this_is_no_command'; $process = new ConditionalProcess($cmd, $condition); $this->assertFalse($process->execute($output)); }
protected function conditionalProcess($cmd, $condition, $timeout) { $process = new ConditionalProcess($cmd, $condition); $process->setTimeout($timeout); $output = ''; $this->line("Running `{$cmd}`..."); try { if ($process->execute($output) && $this->verbosity == OutputInterface::VERBOSITY_VERBOSE) { $this->line($output); } else { $this->info('Success!'); } } catch (ProcessFailedException $e) { $this->error('Failed:'); $this->line($output); } }