public function AbstractProcessTest::testStopWithTimeoutIsActuallyWorking

1 method overrides AbstractProcessTest::testStopWithTimeoutIsActuallyWorking()
SigchildDisabledProcessTest::testStopWithTimeoutIsActuallyWorking in drupal/core/vendor/symfony/process/Symfony/Component/Process/Tests/SigchildDisabledProcessTest.php

File

drupal/core/vendor/symfony/process/Symfony/Component/Process/Tests/AbstractProcessTest.php, line 48

Class

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

Namespace

Symfony\Component\Process\Tests

Code

public function testStopWithTimeoutIsActuallyWorking() {
  if (defined('PHP_WINDOWS_VERSION_BUILD')) {
    $this
      ->markTestSkipped('Stop with timeout does not work on windows, it requires posix signals');
  }

  // exec is mandatory here since we send a signal to the process
  // see https://github.com/symfony/symfony/issues/5030 about prepending
  // command with exec
  $p = $this
    ->getProcess('exec php ' . __DIR__ . '/NonStopableProcess.php 3');
  $p
    ->start();
  usleep(100000);
  $start = microtime(true);
  $p
    ->stop(1.1, SIGKILL);
  while ($p
    ->isRunning()) {
    usleep(1000);
  }
  $duration = microtime(true) - $start;
  $this
    ->assertLessThan(1.3, $duration);
}