X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fconsole%2FTests%2FStyle%2FSymfonyStyleTest.php;fp=vendor%2Fsymfony%2Fconsole%2FTests%2FStyle%2FSymfonyStyleTest.php;h=865bb33f79323289ad2f621e525c8b8597c5c9ef;hp=ef6b72a07cc383f11a9cd11c00ed8ff2fadcdced;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php index ef6b72a07..865bb33f7 100644 --- a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php +++ b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php @@ -14,6 +14,11 @@ namespace Symfony\Component\Console\Tests\Style; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; class SymfonyStyleTest extends TestCase { @@ -71,4 +76,41 @@ class SymfonyStyleTest extends TestCase return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt')); } + + public function testGetErrorStyle() + { + $input = $this->getMockBuilder(InputInterface::class)->getMock(); + + $errorOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); + $errorOutput + ->method('getFormatter') + ->willReturn(new OutputFormatter()); + $errorOutput + ->expects($this->once()) + ->method('write'); + + $output = $this->getMockBuilder(ConsoleOutputInterface::class)->getMock(); + $output + ->method('getFormatter') + ->willReturn(new OutputFormatter()); + $output + ->expects($this->once()) + ->method('getErrorOutput') + ->willReturn($errorOutput); + + $io = new SymfonyStyle($input, $output); + $io->getErrorStyle()->write(''); + } + + public function testGetErrorStyleUsesTheCurrentOutputIfNoErrorOutputIsAvailable() + { + $output = $this->getMockBuilder(OutputInterface::class)->getMock(); + $output + ->method('getFormatter') + ->willReturn(new OutputFormatter()); + + $style = new SymfonyStyle($this->getMockBuilder(InputInterface::class)->getMock(), $output); + + $this->assertInstanceOf(SymfonyStyle::class, $style->getErrorStyle()); + } }