You are here

public function AbstractProcessTest::testIdleTimeoutNotExceededWhenOutputIsSent in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/process/Tests/AbstractProcessTest.php \Symfony\Component\Process\Tests\AbstractProcessTest::testIdleTimeoutNotExceededWhenOutputIsSent()

File

vendor/symfony/process/Tests/AbstractProcessTest.php, line 850

Class

AbstractProcessTest
@author Robert Schönthal <seroscho@googlemail.com>

Namespace

Symfony\Component\Process\Tests

Code

public function testIdleTimeoutNotExceededWhenOutputIsSent() {
  if ('\\' === DIRECTORY_SEPARATOR) {
    $this
      ->markTestIncomplete('This test fails with a timeout on Windows, can someone investigate please?');
  }
  $process = $this
    ->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 30; while ($n--) {echo "foo\\n"; usleep(100000); }')));
  $process
    ->setTimeout(2);
  $process
    ->setIdleTimeout(1);
  try {
    $process
      ->run();
    $this
      ->fail('A timeout exception was expected.');
  } catch (ProcessTimedOutException $ex) {
    $this
      ->assertTrue($ex
      ->isGeneralTimeout(), 'A general timeout is expected.');
    $this
      ->assertFalse($ex
      ->isIdleTimeout(), 'No idle timeout is expected.');
    $this
      ->assertEquals(2, $ex
      ->getExceededTimeout());
  }
}