diff --git a/src/DiffConsoleOutput.php b/src/DiffConsoleOutput.php index 1c9e586..cc381ba 100644 --- a/src/DiffConsoleOutput.php +++ b/src/DiffConsoleOutput.php @@ -19,14 +19,13 @@ use Graze\DiffRenderer\Terminal\TerminalInterface; use Graze\DiffRenderer\Wrap\Wrapper; use Symfony\Component\Console\Formatter\OutputFormatterInterface; -use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; /** * This takes an array of lines to write to the console, does a different and only over-writes what has changed to the * console */ -class DiffConsoleOutput implements ConsoleOutputInterface +class DiffConsoleOutput implements OutputInterface { /** @var string[] */ private $buffer = []; @@ -34,7 +33,7 @@ class DiffConsoleOutput implements ConsoleOutputInterface private $diff; /** @var TerminalInterface */ private $terminal; - /** @var ConsoleOutputInterface */ + /** @var OutputInterface */ private $output; /** @var Wrapper */ private $wrapper; @@ -44,12 +43,12 @@ class DiffConsoleOutput implements ConsoleOutputInterface /** * Constructor. * - * @param ConsoleOutputInterface $output - * @param TerminalInterface $terminal - * @param Wrapper $wrapper + * @param OutputInterface $output + * @param TerminalInterface $terminal + * @param Wrapper $wrapper */ public function __construct( - ConsoleOutputInterface $output, + OutputInterface $output, TerminalInterface $terminal = null, Wrapper $wrapper = null ) { @@ -138,26 +137,6 @@ private function buildOutput(array $diff, $newline = false) return $buffer; } - /** - * Gets the OutputInterface for errors. - * - * @return OutputInterface - */ - public function getErrorOutput() - { - return $this->output->getErrorOutput(); - } - - /** - * Sets the OutputInterface used for errors. - * - * @param OutputInterface $error - */ - public function setErrorOutput(OutputInterface $error) - { - $this->output->setErrorOutput($error); - } - /** * Writes a message to the output and adds a newline at the end. * diff --git a/tests/unit/DiffConsoleOutputPassthroughTest.php b/tests/unit/DiffConsoleOutputPassthroughTest.php index c833f83..9be8853 100644 --- a/tests/unit/DiffConsoleOutputPassthroughTest.php +++ b/tests/unit/DiffConsoleOutputPassthroughTest.php @@ -6,7 +6,6 @@ use Graze\DiffRenderer\Test\TestCase; use Mockery; use Symfony\Component\Console\Formatter\OutputFormatterInterface; -use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; class DiffConsoleOutputPassThroughTest extends TestCase @@ -20,18 +19,13 @@ public function setUp() { parent::setUp(); - $this->output = Mockery::mock(ConsoleOutputInterface::class); + $this->output = Mockery::mock(OutputInterface::class); $this->diffOutput = new DiffConsoleOutput($this->output); } - public function testGetErrorOutput() + public function testInstanceOf() { - $output = Mockery::mock(OutputInterface::class); - $this->output->shouldReceive('getErrorOutput') - ->with() - ->andReturn($output); - - $this->assertSame($output, $this->diffOutput->getErrorOutput()); + $this->assertInstanceOf(OutputInterface::class, $this->diffOutput); } public function testGetVerbosity() @@ -116,16 +110,6 @@ public function testSetDecorated() $this->diffOutput->setDecorated(true); } - public function testSetErrorOutput() - { - $error = Mockery::mock(OutputInterface::class); - $this->output->shouldReceive('setErrorOutput') - ->with($error) - ->once(); - - $this->diffOutput->setErrorOutput($error); - } - public function testSetFormatter() { $formatter = Mockery::mock(OutputFormatterInterface::class); diff --git a/tests/unit/DiffConsoleOutputTest.php b/tests/unit/DiffConsoleOutputTest.php index 6cf5ed7..8f533e0 100644 --- a/tests/unit/DiffConsoleOutputTest.php +++ b/tests/unit/DiffConsoleOutputTest.php @@ -19,7 +19,7 @@ use Graze\DiffRenderer\Test\TestCase; use Graze\DiffRenderer\Wrap\Wrapper; use Mockery; -use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\OutputInterface; class DiffConsoleOutputTest extends TestCase { @@ -36,7 +36,7 @@ class DiffConsoleOutputTest extends TestCase public function setUp() { - $this->output = Mockery::mock(ConsoleOutput::class); + $this->output = Mockery::mock(OutputInterface::class); $this->wrapper = Mockery::mock(Wrapper::class)->makePartial(); $this->dimensions = Mockery::mock(DimensionsInterface::class); $this->terminal = new Terminal(null, $this->dimensions);