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