4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Console\Tests\Output;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Console\Formatter\OutputFormatter;
16 use Symfony\Component\Console\Output\ConsoleOutput;
17 use Symfony\Component\Console\Output\Output;
19 class ConsoleOutputTest extends TestCase
21 public function testConstructor()
23 $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true);
24 $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument');
25 $this->assertSame($output->getFormatter(), $output->getErrorOutput()->getFormatter(), '__construct() takes a formatter or null as the third argument');
28 public function testSetFormatter()
30 $output = new ConsoleOutput();
31 $outputFormatter = new OutputFormatter();
32 $output->setFormatter($outputFormatter);
33 $this->assertSame($outputFormatter, $output->getFormatter());
36 public function testSetVerbosity()
38 $output = new ConsoleOutput();
39 $output->setVerbosity(Output::VERBOSITY_VERBOSE);
40 $this->assertSame(Output::VERBOSITY_VERBOSE, $output->getVerbosity());