NullOutputTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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\Output;
  11. use Symfony\Component\Console\Output\NullOutput;
  12. use Symfony\Component\Console\Output\OutputInterface;
  13. class NullOutputTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testConstructor()
  16. {
  17. $output = new NullOutput();
  18. ob_start();
  19. $output->write('foo');
  20. $buffer = ob_get_clean();
  21. $this->assertSame('', $buffer, '->write() does nothing (at least nothing is printed)');
  22. $this->assertFalse($output->isDecorated(), '->isDecorated() returns false');
  23. }
  24. public function testVerbosity()
  25. {
  26. $output = new NullOutput();
  27. $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() returns VERBOSITY_QUIET for NullOutput by default');
  28. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  29. $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() always returns VERBOSITY_QUIET for NullOutput');
  30. }
  31. }