/** * 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); }
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; } }
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; } }