You are here

public function ProcessFailedExceptionTest::testDisabledOutputInFailedExceptionDoesNotPopulateOutput in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/process/Tests/ProcessFailedExceptionTest.php \Symfony\Component\Process\Tests\ProcessFailedExceptionTest::testDisabledOutputInFailedExceptionDoesNotPopulateOutput()

Tests that ProcessFailedException does not extract information from process output if it was previously disabled.

File

vendor/symfony/process/Tests/ProcessFailedExceptionTest.php, line 96

Class

ProcessFailedExceptionTest
@author Sebastian Marek <proofek@gmail.com>

Namespace

Symfony\Component\Process\Tests

Code

public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput() {
  $cmd = 'php';
  $exitCode = 1;
  $exitText = 'General error';
  $process = $this
    ->getMock('Symfony\\Component\\Process\\Process', array(
    'isSuccessful',
    'isOutputDisabled',
    'getExitCode',
    'getExitCodeText',
    'getOutput',
    'getErrorOutput',
  ), array(
    $cmd,
  ));
  $process
    ->expects($this
    ->once())
    ->method('isSuccessful')
    ->will($this
    ->returnValue(false));
  $process
    ->expects($this
    ->never())
    ->method('getOutput');
  $process
    ->expects($this
    ->never())
    ->method('getErrorOutput');
  $process
    ->expects($this
    ->once())
    ->method('getExitCode')
    ->will($this
    ->returnValue($exitCode));
  $process
    ->expects($this
    ->once())
    ->method('getExitCodeText')
    ->will($this
    ->returnValue($exitText));
  $process
    ->expects($this
    ->once())
    ->method('isOutputDisabled')
    ->will($this
    ->returnValue(true));
  $exception = new ProcessFailedException($process);
  $this
    ->assertEquals("The command \"{$cmd}\" failed.\nExit Code: {$exitCode}({$exitText})", $exception
    ->getMessage());
}