From 7a5aa5814f5cf3e415a9d3828b3c615be000b6f6 Mon Sep 17 00:00:00 2001 From: "steve.brazier" Date: Thu, 12 Dec 2013 14:37:47 +0000 Subject: [PATCH] add tests for CommandExecutor. --- Tests/PHPCI/Helper/CommandExecutorTest.php | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Tests/PHPCI/Helper/CommandExecutorTest.php diff --git a/Tests/PHPCI/Helper/CommandExecutorTest.php b/Tests/PHPCI/Helper/CommandExecutorTest.php new file mode 100644 index 00000000..217844b1 --- /dev/null +++ b/Tests/PHPCI/Helper/CommandExecutorTest.php @@ -0,0 +1,36 @@ +prophesize('\PHPCI\BuildLogger'); + $this->testedExecutor = new CommandExecutor($mockBuildLogger->reveal()); + } + + public function testGetLastOutput_ReturnsOutputOfCommand() + { + $this->testedExecutor->executeCommand(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')); + $output = $this->testedExecutor->getLastOutput(); + $this->assertEquals("Hello Tester", $output); + } +} \ No newline at end of file