rename CommandExecutor::executeCommand() so that it's not confused with the Builder::executeCommand()

This commit is contained in:
meadsteve 2013-12-13 14:41:02 +00:00
parent 8d8714746c
commit 3a3cc98f86
3 changed files with 17 additions and 7 deletions

View file

@ -217,7 +217,7 @@ class Builder implements LoggerAwareInterface, BuildLogger
*/
public function executeCommand()
{
return $this->commandExecutor->executeCommand(func_get_args());
return $this->commandExecutor->buildAndExecuteCommand(func_get_args());
}
/**

View file

@ -47,12 +47,22 @@ class CommandExecutor
$this->rootDir = $rootDir;
}
/**
* Executes shell commands. Accepts multiple arguments the first
* is the template and everything else is inserted in. c.f. sprintf
* @return bool Indicates success
*/
public function executeCommand()
{
return $this->buildAndExecuteCommand(func_get_args());
}
/**
* Executes shell commands.
* @param array $args
* @return bool Indicates success
*/
public function executeCommand($args = array())
public function buildAndExecuteCommand($args = array())
{
$this->lastOutput = array();

View file

@ -21,28 +21,28 @@ class CommandExecutorTest extends ProphecyTestCase
public function testGetLastOutput_ReturnsOutputOfCommand()
{
$this->testedExecutor->executeCommand(array('echo "%s"', 'Hello World'));
$this->testedExecutor->buildAndExecuteCommand(array('echo "%s"', 'Hello World'));
$output = $this->testedExecutor->getLastOutput();
$this->assertEquals("Hello World", $output);
}
public function testGetLastOutput_ForgetsPreviousCommandOutput()
{
$this->testedExecutor->executeCommand(array('echo "%s"', 'Hello World'));
$this->testedExecutor->executeCommand(array('echo "%s"', 'Hello Tester'));
$this->testedExecutor->buildAndExecuteCommand(array('echo "%s"', 'Hello World'));
$this->testedExecutor->buildAndExecuteCommand(array('echo "%s"', 'Hello Tester'));
$output = $this->testedExecutor->getLastOutput();
$this->assertEquals("Hello Tester", $output);
}
public function testExecuteCommand_ReturnsTrueForValidCommands()
{
$returnValue = $this->testedExecutor->executeCommand(array('echo "%s"', 'Hello World'));
$returnValue = $this->testedExecutor->buildAndExecuteCommand(array('echo "%s"', 'Hello World'));
$this->assertTrue($returnValue);
}
public function testExecuteCommand_ReturnsFalseForInvalidCommands()
{
$returnValue = $this->testedExecutor->executeCommand(array('eerfdcvcho "%s"', 'Hello World'));
$returnValue = $this->testedExecutor->buildAndExecuteCommand(array('eerfdcvcho "%s"', 'Hello World'));
$this->assertFalse($returnValue);
}