예제 #1
0
 public function testProcessBackground()
 {
     $cmd = new Command('php', __DIR__ . '/command/basic.php');
     $this->assertEquals('php ' . __DIR__ . '/command/basic.php', $cmd->getCommandLine());
     $cmd->exec(true);
     $processes = System::processes('php');
     $this->assertEquals(count($processes), Manager::os()->countProcesses('php'));
     $this->assertTrue(is_array($processes));
     $this->assertEquals(2, count($processes));
     $this->assertInstanceOf('\\Ark4ne\\Processes\\Process\\Process', $processes[0]);
     $this->assertInstanceOf('\\Ark4ne\\Processes\\Process\\Process', $processes[1]);
     $processes[1]->kill();
 }
예제 #2
0
 public function testKill()
 {
     $cmd = new Command('php', __DIR__ . '/command/basic.php');
     if (\Ark4ne\Processes\System\OS\Manager::isWin()) {
         $this->assertNull($cmd->exec(true));
     } else {
         $this->assertInstanceOf('\\Ark4ne\\Processes\\Process\\Process', $cmd->exec(true));
     }
     $processes = System::processes('php');
     $this->assertEquals(2, count($processes));
     $this->assertInstanceOf('\\Ark4ne\\Processes\\Process\\Process', $processes[0]);
     $processes[1]->kill();
     $processes = System::processes('php');
     $this->assertEquals(1, count($processes));
 }