/**
  * was the command successful, according to its return code?
  *
  * this isn't 100% reliable, as there are plenty of CLI commands out
  * there which no longer respect the UNIX convention on return codes
  *
  * @param  ProcessResult $commandResult
  *         the result to check
  * @return boolean
  *         TRUE if the command was successful
  *         FALSE otherwise
  */
 public static function checkProcessResult(ProcessResult $commandResult)
 {
     if ($commandResult->getReturnCode() === 0) {
         return true;
     }
     return false;
 }
 public function __construct(ProcessResult $result)
 {
     $msg = "Command '" . $result->getCommandAsString() . ' succeeded with return code ' . $result->getReturnCode();
     parent::__construct(400, $msg, ['result' => $result]);
 }
    /**
     * @covers ::__construct
     */
    public function testCanGetCommandOutput()
    {
        // ----------------------------------------------------------------
        // setup your test
        $expectedResult = <<<EOF
This is the fake output of running a command
which includes new lines

and blank lines

and anything, really
EOF;
        $obj = new ProcessResult([], 0, $expectedResult);
        // ----------------------------------------------------------------
        // perform the change
        $actualResult = $obj->getOutput();
        // ----------------------------------------------------------------
        // test the results
        $this->assertEquals($expectedResult, $actualResult);
    }