add tests for CommandExecutor.
This commit is contained in:
parent
d26568b962
commit
7a5aa5814f
36
Tests/PHPCI/Helper/CommandExecutorTest.php
Normal file
36
Tests/PHPCI/Helper/CommandExecutorTest.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCI\Plugin\Tests\Helper;
|
||||
|
||||
use PHPCI\Helper\CommandExecutor;
|
||||
use \Prophecy\PhpUnit\ProphecyTestCase;
|
||||
|
||||
class CommandExecutorTest extends ProphecyTestCase
|
||||
{
|
||||
/**
|
||||
* @var CommandExecutor
|
||||
*/
|
||||
protected $testedExecutor;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$mockBuildLogger = $this->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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue