HtmlOutputFormatterTest.php 1010 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test\Console;
  12. use Composer\Console\HtmlOutputFormatter;
  13. use Composer\Test\TestCase;
  14. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  15. class HtmlOutputFormatterTest extends TestCase
  16. {
  17. public function testFormatting()
  18. {
  19. $formatter = new HtmlOutputFormatter(array(
  20. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  21. ));
  22. $this->assertEquals(
  23. 'text <span style="color:green;">green</span> <span style="color:yellow;">yellow</span> <span style="color:black;background-color:yellow;">black w/ yello bg</span>',
  24. $formatter->format('text <info>green</info> <comment>yellow</comment> <warning>black w/ yello bg</warning>')
  25. );
  26. }
  27. }