NullOutputFormatterTest.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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\NullOutputFormatter;
  13. use Symfony\Component\Console\Formatter\NullOutputFormatterStyle;
  14. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  15. /**
  16. * @author Tien Xuan Vo <tien.xuan.vo@gmail.com>
  17. */
  18. class NullOutputFormatterTest extends TestCase
  19. {
  20. public function testFormat()
  21. {
  22. $formatter = new NullOutputFormatter();
  23. $this->assertNull($formatter->format('this message will be destroyed'));
  24. }
  25. public function testGetStyle()
  26. {
  27. $formatter = new NullOutputFormatter();
  28. $this->assertInstanceof(NullOutputFormatterStyle::class, $style = $formatter->getStyle('null'));
  29. $this->assertSame($style, $formatter->getStyle('null'));
  30. }
  31. public function testSetStyle()
  32. {
  33. $formatter = new NullOutputFormatter();
  34. $style = new OutputFormatterStyle();
  35. $formatter->setStyle('null', $style);
  36. $this->assertNotSame($style, $formatter->getStyle('null'));
  37. }
  38. public function testHasStyle()
  39. {
  40. $formatter = new NullOutputFormatter();
  41. $this->assertFalse($formatter->hasStyle('null'));
  42. }
  43. public function testIsDecorated()
  44. {
  45. $formatter = new NullOutputFormatter();
  46. $this->assertFalse($formatter->isDecorated());
  47. }
  48. public function testSetDecorated()
  49. {
  50. $formatter = new NullOutputFormatter();
  51. $formatter->setDecorated(true);
  52. $this->assertFalse($formatter->isDecorated());
  53. }
  54. }