public function AbstractProcessTest::testStatus

File

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

Class

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

Namespace

Symfony\Component\Process\Tests

Code

public function testStatus() {
  $process = $this
    ->getProcess('php -r "usleep(500000);"');
  $this
    ->assertFalse($process
    ->isRunning());
  $this
    ->assertFalse($process
    ->isStarted());
  $this
    ->assertFalse($process
    ->isTerminated());
  $this
    ->assertSame(Process::STATUS_READY, $process
    ->getStatus());
  $process
    ->start();
  $this
    ->assertTrue($process
    ->isRunning());
  $this
    ->assertTrue($process
    ->isStarted());
  $this
    ->assertFalse($process
    ->isTerminated());
  $this
    ->assertSame(Process::STATUS_STARTED, $process
    ->getStatus());
  $process
    ->wait();
  $this
    ->assertFalse($process
    ->isRunning());
  $this
    ->assertTrue($process
    ->isStarted());
  $this
    ->assertTrue($process
    ->isTerminated());
  $this
    ->assertSame(Process::STATUS_TERMINATED, $process
    ->getStatus());
}