[Process] Add ability to reset arguments on ProcessBuilder
This commit is contained in:
parent
9681973676
commit
63b00598fe
@ -4,6 +4,7 @@ CHANGELOG
|
||||
2.2.0
|
||||
-----
|
||||
|
||||
* added ProcessBuilder::setArguments() to reset the arguments on a builder
|
||||
* added a way to retrieve the standard and error output incrementally
|
||||
* added Process:restart()
|
||||
|
||||
|
@ -56,6 +56,18 @@ class ProcessBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return ProcessBuilder
|
||||
*/
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
$this->arguments = $arguments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setWorkingDirectory($cwd)
|
||||
{
|
||||
$this->cwd = $cwd;
|
||||
|
@ -105,4 +105,14 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertNull($p->getValue($pb));
|
||||
}
|
||||
|
||||
public function testShouldSetArguments()
|
||||
{
|
||||
$pb = new ProcessBuilder(array('initial'));
|
||||
$pb->setArguments(array('second'));
|
||||
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
$this->assertContains("second", $proc->getCommandLine());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user