prophesize('\Symfony\Component\Console\Output\OutputInterface'); $output->getVerbosity()->willReturn($verbosity); $handler = new OutputLogHandler($output->reveal()); $this->assertEquals($level, $handler->getLevel()); } public function getVerbosityLevelMap() { return array( array(OutputInterface::VERBOSITY_QUIET, Logger::ERROR), array(OutputInterface::VERBOSITY_NORMAL, Logger::WARNING), array(OutputInterface::VERBOSITY_VERBOSE, Logger::NOTICE), array(OutputInterface::VERBOSITY_VERY_VERBOSE, Logger::INFO), array(OutputInterface::VERBOSITY_DEBUG, Logger::DEBUG), ); } public function testSendInfoToOutput() { $record = array('message' => 'FOO', 'level' => Logger::INFO); $output = $this->prophesize('\Symfony\Component\Console\Output\ConsoleOutputInterface'); $output->getVerbosity()->willReturn(OutputInterface::VERBOSITY_DEBUG); $output->getErrorOutput()->shouldNotBeCalled(); $output->write('BAR')->shouldBeCalled(); $formatter = $this->prophesize('\Monolog\Formatter\FormatterInterface'); $formatter->format($record)->willReturn('BAR'); $handler = new OutputLogHandler($output->reveal()); $handler->setFormatter($formatter->reveal()); $handler->handle($record); } public function testSendErrorsToStderr() { $record = array('message' => 'FOO', 'level' => Logger::ERROR); $error = $this->prophesize('\Symfony\Component\Console\Output\OutputInterface'); $error->write('BAR')->shouldBeCalled(); $output = $this->prophesize('\Symfony\Component\Console\Output\ConsoleOutputInterface'); $output->getVerbosity()->willReturn(OutputInterface::VERBOSITY_DEBUG); $output->getErrorOutput()->willReturn($error); $formatter = $this->prophesize('\Monolog\Formatter\FormatterInterface'); $formatter->format(array('message' => 'FOO', 'level' => Logger::ERROR))->willReturn('BAR'); $handler = new OutputLogHandler($output->reveal()); $handler->setFormatter($formatter->reveal()); $handler->handle($record); } }