Yaffs site version 1.1
[yaffs-website] / vendor / symfony / console / Tests / Output / NullOutputTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Console\Tests\Output;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Console\Formatter\OutputFormatter;
16 use Symfony\Component\Console\Output\NullOutput;
17 use Symfony\Component\Console\Output\Output;
18 use Symfony\Component\Console\Output\OutputInterface;
19
20 class NullOutputTest extends TestCase
21 {
22     public function testConstructor()
23     {
24         $output = new NullOutput();
25
26         ob_start();
27         $output->write('foo');
28         $buffer = ob_get_clean();
29
30         $this->assertSame('', $buffer, '->write() does nothing (at least nothing is printed)');
31         $this->assertFalse($output->isDecorated(), '->isDecorated() returns false');
32     }
33
34     public function testVerbosity()
35     {
36         $output = new NullOutput();
37         $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() returns VERBOSITY_QUIET for NullOutput by default');
38
39         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
40         $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() always returns VERBOSITY_QUIET for NullOutput');
41     }
42
43     public function testSetFormatter()
44     {
45         $output = new NullOutput();
46         $outputFormatter = new OutputFormatter();
47         $output->setFormatter($outputFormatter);
48         $this->assertNotSame($outputFormatter, $output->getFormatter());
49     }
50
51     public function testSetVerbosity()
52     {
53         $output = new NullOutput();
54         $output->setVerbosity(Output::VERBOSITY_NORMAL);
55         $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity());
56     }
57
58     public function testSetDecorated()
59     {
60         $output = new NullOutput();
61         $output->setDecorated(true);
62         $this->assertFalse($output->isDecorated());
63     }
64
65     public function testIsQuiet()
66     {
67         $output = new NullOutput();
68         $this->assertTrue($output->isQuiet());
69     }
70
71     public function testIsVerbose()
72     {
73         $output = new NullOutput();
74         $this->assertFalse($output->isVerbose());
75     }
76
77     public function testIsVeryVerbose()
78     {
79         $output = new NullOutput();
80         $this->assertFalse($output->isVeryVerbose());
81     }
82
83     public function testIsDebug()
84     {
85         $output = new NullOutput();
86         $this->assertFalse($output->isDebug());
87     }
88 }