use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\Output;
class ConsoleOutputTest extends TestCase
{ public function testConstructorWithoutFormatter() { $output =
new ConsoleOutput(Output::VERBOSITY_QUIET, true
);
$this->
assertEquals(Output::VERBOSITY_QUIET,
$output->
getVerbosity(), '__construct() takes the verbosity as its first argument'
);
$this->
assertNotSame($output->
getFormatter(),
$output->
getErrorOutput()->
getFormatter(), 'ErrorOutput should use it own formatter'
);
} public function testConstructorWithFormatter() { $output =
new ConsoleOutput(Output::VERBOSITY_QUIET, true,
$formatter =
new OutputFormatter());
$this->
assertEquals(Output::VERBOSITY_QUIET,
$output->
getVerbosity(), '__construct() takes the verbosity as its first argument'
);
$this->
assertSame($formatter,
$output->
getFormatter());
$this->
assertSame($formatter,
$output->
getErrorOutput()->
getFormatter(), 'Output and ErrorOutput should use the same provided formatter'
);
}