You are here

public function AbstractProcessTest::testCheckTimeoutOnStartedProcess 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::testCheckTimeoutOnStartedProcess()
1 call to AbstractProcessTest::testCheckTimeoutOnStartedProcess()
SigchildDisabledProcessTest::testCheckTimeoutOnStartedProcess in vendor/symfony/process/Tests/SigchildDisabledProcessTest.php
@expectedException \Symfony\Component\Process\Exception\RuntimeException @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
2 methods override AbstractProcessTest::testCheckTimeoutOnStartedProcess()
SigchildDisabledProcessTest::testCheckTimeoutOnStartedProcess in vendor/symfony/process/Tests/SigchildDisabledProcessTest.php
@expectedException \Symfony\Component\Process\Exception\RuntimeException @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
SigchildEnabledProcessTest::testCheckTimeoutOnStartedProcess in vendor/symfony/process/Tests/SigchildEnabledProcessTest.php

File

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

Class

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

Namespace

Symfony\Component\Process\Tests

Code

public function testCheckTimeoutOnStartedProcess() {
  $timeout = 0.5;
  $precision = 100000;
  $process = $this
    ->getProcess(self::$phpBin . ' -r "sleep(3);"');
  $process
    ->setTimeout($timeout);
  $start = microtime(true);
  $process
    ->start();
  try {
    while ($process
      ->isRunning()) {
      $process
        ->checkTimeout();
      usleep($precision);
    }
    $this
      ->fail('A RuntimeException should have been raised');
  } catch (RuntimeException $e) {
  }
  $duration = microtime(true) - $start;
  $this
    ->assertLessThan($timeout + $precision, $duration);
  $this
    ->assertFalse($process
    ->isSuccessful());
}