NullOutputFormatterStyleTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Tests\Formatter;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Console\Formatter\NullOutputFormatterStyle;
  13. /**
  14. * @author Tien Xuan Vo <tien.xuan.vo@gmail.com>
  15. */
  16. class NullOutputFormatterStyleTest extends TestCase
  17. {
  18. public function testApply()
  19. {
  20. $style = new NullOutputFormatterStyle();
  21. $this->assertSame('foo', $style->apply('foo'));
  22. }
  23. public function testSetForeground()
  24. {
  25. $style = new NullOutputFormatterStyle();
  26. $style->setForeground('black');
  27. $this->assertSame('foo', $style->apply('foo'));
  28. }
  29. public function testSetBackground()
  30. {
  31. $style = new NullOutputFormatterStyle();
  32. $style->setBackground('blue');
  33. $this->assertSame('foo', $style->apply('foo'));
  34. }
  35. public function testOptions()
  36. {
  37. $style = new NullOutputFormatterStyle();
  38. $style->setOptions(['reverse', 'conceal']);
  39. $this->assertSame('foo', $style->apply('foo'));
  40. $style->setOption('bold');
  41. $this->assertSame('foo', $style->apply('foo'));
  42. $style->unsetOption('reverse');
  43. $this->assertSame('foo', $style->apply('foo'));
  44. }
  45. }