[Process] Add ability to reset arguments on ProcessBuilder

This commit is contained in:
Alexander 2012-10-28 16:19:50 +01:00 committed by Fabien Potencier
parent 9681973676
commit 63b00598fe
3 changed files with 23 additions and 0 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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());
}
}