Example #1
0
 public function testRunInBackgroundExecutesCommandsAsynchronously()
 {
     $terminal = new Terminal();
     $command = new ShellCommand("sleep", ["5"]);
     $pid = $terminal->runInBackground($command);
     $pidFile = "/proc/" . $pid;
     for ($i = 0; $i < 5; ++$i) {
         $this->assertFileExists($pidFile);
         sleep(1);
     }
     $this->assertFileNotExists($pid);
 }