コード例 #1
0
ファイル: ProcessTest.php プロジェクト: todiadiyatmo/phpbu
 /**
  * Tests Process::getCommandLine
  */
 public function testGetCommandLineMultiCommand()
 {
     $cmd1 = new Cmd('echo');
     $cmd1->addArgument('foo');
     $cmd2 = new Cmd('echo');
     $cmd2->addArgument('bar');
     $process = new Process();
     $process->addCommand($cmd1);
     $process->addCommand($cmd2);
     $res = $process->getCommandLine();
     $this->assertEquals('(echo \'foo\' && echo \'bar\')', $res);
 }
コード例 #2
0
 public function information()
 {
     $p = new Process($this->executable(), $this->arguments('-v'));
     try {
         $this->assertEquals(-1, $p->exitValue(), 'Process should not have exited yet');
         $this->assertNotEquals(0, $p->getProcessId());
         $this->assertNotEquals('', $p->getFilename());
         $this->assertNotEquals(false, strpos($p->getCommandLine(), '-v'));
         $p->close();
     } catch (AssertionFailedError $e) {
         $p->close();
         // Ensure process is closed
         throw $e;
     }
 }
コード例 #3
0
 public function information()
 {
     $p = new Process($this->executable(), array('-v'));
     try {
         $this->assertEquals(-1, $p->exitValue(), 'Process should not have exited yet');
         $this->assertNotEquals(0, $p->getProcessId());
         $this->assertNotEquals('', $p->getFilename());
         $this->assertTrue(create(new String($p->getCommandLine()))->contains('-v'));
         $p->close();
     } catch (AssertionFailedError $e) {
         $p->close();
         // Ensure process is closed
         throw $e;
     }
 }