Пример #1
0
 public function testSetStyle()
 {
     Output::setStyle('FOO', array('bg' => 'red', 'fg' => 'yellow', 'blink' => true));
     $this->assertEquals(TestOutput::getStyle('foo'), array('bg' => 'red', 'fg' => 'yellow', 'blink' => true), '::setStyle() sets a new style');
 }
Пример #2
0
$t->is($output->isDecorated(), true, '__construct() takes the decorated flag as its second argument');

// ->setDecorated() ->isDecorated()
$t->diag('->setDecorated() ->isDecorated()');
$output = new TestOutput();
$output->setDecorated(true);
$t->is($output->isDecorated(), true, 'setDecorated() sets the decorated flag');

// ->setVerbosity() ->getVerbosity()
$t->diag('->setVerbosity() ->getVerbosity()');
$output->setVerbosity(Output::VERBOSITY_QUIET);
$t->is($output->getVerbosity(), Output::VERBOSITY_QUIET, '->setVerbosity() sets the verbosity');

// ::setStyle()
$t->diag('::setStyle()');
Output::setStyle('FOO', array('bg' => 'red', 'fg' => 'yellow', 'blink' => true));
$t->is(TestOutput::getStyle('foo'), array('bg' => 'red', 'fg' => 'yellow', 'blink' => true), '::setStyle() sets a new style');

// ->writeln()
$t->diag('->writeln()');
$output = new TestOutput(Output::VERBOSITY_QUIET);
$output->writeln('foo');
$t->is($output->output, '', '->writeln() outputs nothing if verbosity is set to VERBOSITY_QUIET');

$output = new TestOutput();
$output->writeln(array('foo', 'bar'));
$t->is($output->output, "foo\nbar\n", '->writeln() can take an array of messages to output');

$output = new TestOutput();
$output->writeln('<info>foo</info>', Output::OUTPUT_RAW);
$t->is($output->output, "<info>foo</info>\n", '->writeln() outputs the raw message if OUTPUT_RAW is specified');