|
@@ -12,6 +12,7 @@
|
|
|
namespace Symfony\Tests\Component\Console\Output;
|
|
|
|
|
|
use Symfony\Component\Console\Output\Output;
|
|
|
+use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
|
|
|
|
|
class OutputTest extends \PHPUnit_Framework_TestCase
|
|
|
{
|
|
@@ -36,20 +37,9 @@ class OutputTest extends \PHPUnit_Framework_TestCase
|
|
|
$this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '->setVerbosity() sets the verbosity');
|
|
|
}
|
|
|
|
|
|
- public function testSetStyle()
|
|
|
- {
|
|
|
- Output::setStyle('FOO', array('bg' => 'red', 'fg' => 'yellow', 'blink' => true));
|
|
|
-
|
|
|
- $r = new \ReflectionClass('Symfony\Component\Console\Output\Output');
|
|
|
- $p = $r->getProperty('styles');
|
|
|
- $p->setAccessible(true);
|
|
|
- $styles = $p->getValue(null);
|
|
|
-
|
|
|
- $this->assertEquals(array('bg' => 'red', 'fg' => 'yellow', 'blink' => true), $styles['foo'], '::setStyle() sets a new style');
|
|
|
- }
|
|
|
-
|
|
|
public function testWrite()
|
|
|
{
|
|
|
+ $fooStyle = new OutputFormatterStyle('yellow', 'red', array('blink'));
|
|
|
$output = new TestOutput(Output::VERBOSITY_QUIET);
|
|
|
$output->writeln('foo');
|
|
|
$this->assertEquals('', $output->output, '->writeln() outputs nothing if verbosity is set to VERBOSITY_QUIET');
|
|
@@ -72,6 +62,7 @@ class OutputTest extends \PHPUnit_Framework_TestCase
|
|
|
$this->assertEquals("foo\n", $output->output, '->writeln() strips decoration tags if decoration is set to false');
|
|
|
|
|
|
$output = new TestOutput();
|
|
|
+ $output->getFormatter()->setStyle('FOO', $fooStyle);
|
|
|
$output->setDecorated(true);
|
|
|
$output->writeln('<foo>foo</foo>');
|
|
|
$this->assertEquals("\033[33;41;5mfoo\033[0m\n", $output->output, '->writeln() decorates the output');
|