Selaa lähdekoodia

[Console] updated output tests after formatter adding

ever.zet 14 vuotta sitten
vanhempi
commit
8b55c239a2
1 muutettua tiedostoa jossa 3 lisäystä ja 12 poistoa
  1. 3 12
      tests/Symfony/Tests/Component/Console/Output/OutputTest.php

+ 3 - 12
tests/Symfony/Tests/Component/Console/Output/OutputTest.php

@@ -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');