HtmlOutputFormatterTest.php 995 B

12345678910111213141516171819202122232425262728293031
  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;
  12. use Composer\Console\HtmlOutputFormatter;
  13. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  14. class HtmlOutputFormatterTest extends \PHPUnit_Framework_TestCase
  15. {
  16. public function testFormatting()
  17. {
  18. $formatter = new HtmlOutputFormatter(array(
  19. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  20. ));
  21. return $this->assertEquals(
  22. '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>',
  23. $formatter->format('text <info>green</info> <comment>yellow</comment> <warning>black w/ yello bg</warning>')
  24. );
  25. }
  26. }