2010-03-18 07:48:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2010-04-25 16:06:54 +01:00
|
|
|
* This file is part of the Symfony package.
|
2011-01-15 13:29:43 +00:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2010-03-18 07:48:03 +00:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2012-03-28 14:43:52 +01:00
|
|
|
namespace Symfony\Component\Console\Tests\Output;
|
2010-03-18 07:48:03 +00:00
|
|
|
|
2017-01-02 08:16:49 +00:00
|
|
|
use Symfony\Component\Console\Formatter\OutputFormatter;
|
2010-08-20 22:09:55 +01:00
|
|
|
use Symfony\Component\Console\Output\NullOutput;
|
2017-01-02 08:16:49 +00:00
|
|
|
use Symfony\Component\Console\Output\Output;
|
2013-05-14 16:31:22 +01:00
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
2010-03-18 07:48:03 +00:00
|
|
|
|
|
|
|
class NullOutputTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
2010-05-06 12:25:53 +01:00
|
|
|
public function testConstructor()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
2013-05-14 16:31:22 +01:00
|
|
|
|
|
|
|
ob_start();
|
2010-05-06 12:25:53 +01:00
|
|
|
$output->write('foo');
|
2013-05-14 16:31:22 +01:00
|
|
|
$buffer = ob_get_clean();
|
|
|
|
|
|
|
|
$this->assertSame('', $buffer, '->write() does nothing (at least nothing is printed)');
|
2013-05-14 16:58:06 +01:00
|
|
|
$this->assertFalse($output->isDecorated(), '->isDecorated() returns false');
|
2013-05-14 16:31:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testVerbosity()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() returns VERBOSITY_QUIET for NullOutput by default');
|
|
|
|
|
|
|
|
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
|
|
|
|
$this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() always returns VERBOSITY_QUIET for NullOutput');
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
2017-01-02 08:16:49 +00:00
|
|
|
|
|
|
|
public function testSetFormatter()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$outputFormatter = new OutputFormatter();
|
|
|
|
$output->setFormatter($outputFormatter);
|
|
|
|
$this->assertNotSame($outputFormatter, $output->getFormatter());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSetVerbosity()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$output->setVerbosity(Output::VERBOSITY_NORMAL);
|
|
|
|
$this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSetDecorated()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$output->setDecorated(true);
|
|
|
|
$this->assertFalse($output->isDecorated());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsQuiet()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$this->assertTrue($output->isQuiet());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsVerbose()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$this->assertFalse($output->isVerbose());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsVeryVerbose()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$this->assertFalse($output->isVeryVerbose());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsDebug()
|
|
|
|
{
|
|
|
|
$output = new NullOutput();
|
|
|
|
$this->assertFalse($output->isDebug());
|
|
|
|
}
|
2010-03-18 07:48:03 +00:00
|
|
|
}
|