You are here

public function AbstractProcessTest::testRestart 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::testRestart()

File

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

Class

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

Namespace

Symfony\Component\Process\Tests

Code

public function testRestart() {
  $process1 = $this
    ->getProcess(self::$phpBin . ' -r "echo getmypid();"');
  $process1
    ->run();
  $process2 = $process1
    ->restart();
  $process2
    ->wait();

  // wait for output
  // Ensure that both processed finished and the output is numeric
  $this
    ->assertFalse($process1
    ->isRunning());
  $this
    ->assertFalse($process2
    ->isRunning());
  $this
    ->assertTrue(is_numeric($process1
    ->getOutput()));
  $this
    ->assertTrue(is_numeric($process2
    ->getOutput()));

  // Ensure that restart returned a new process by check that the output is different
  $this
    ->assertNotEquals($process1
    ->getOutput(), $process2
    ->getOutput());
}