You are here

public function AbstractProcessTest::testMethodsThatNeedATerminatedProcess in Zircon Profile 8

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

@dataProvider provideMethodsThatNeedATerminatedProcess

File

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

Class

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

Namespace

Symfony\Component\Process\Tests

Code

public function testMethodsThatNeedATerminatedProcess($method) {
  $process = $this
    ->getProcess(self::$phpBin . ' -r "sleep(1);"');
  $process
    ->start();
  try {
    $process
      ->{$method}();
    $process
      ->stop(0);
    $this
      ->fail('A LogicException must have been thrown');
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf('Symfony\\Component\\Process\\Exception\\LogicException', $e);
    $this
      ->assertEquals(sprintf('Process must be terminated before calling %s.', $method), $e
      ->getMessage());
  }
  $process
    ->stop(0);
}