ConsoleOutputTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\Formatter\OutputFormatter;
  12. use Symfony\Component\Console\Output\ConsoleOutput;
  13. use Symfony\Component\Console\Output\Output;
  14. class ConsoleOutputTest extends \PHPUnit_Framework_TestCase
  15. {
  16. public function testConstructor()
  17. {
  18. $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true);
  19. $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument');
  20. $this->assertSame($output->getFormatter(), $output->getErrorOutput()->getFormatter(), '__construct() takes a formatter or null as the third argument');
  21. }
  22. public function testSetFormatter()
  23. {
  24. $output = new ConsoleOutput();
  25. $outputFormatter = new OutputFormatter();
  26. $output->setFormatter($outputFormatter);
  27. $this->assertSame($outputFormatter, $output->getFormatter());
  28. }
  29. public function testSetVerbosity()
  30. {
  31. $output = new ConsoleOutput();
  32. $output->setVerbosity(Output::VERBOSITY_VERBOSE);
  33. $this->assertSame(Output::VERBOSITY_VERBOSE, $output->getVerbosity());
  34. }
  35. }