/**
  * @param string $logLevel
  * @param int $logLevelCode
  * @dataProvider dataProviderProcessSuccess
  * @return void
  */
 public function testProcessSuccess($logLevel, $logLevelCode)
 {
     $this->logger->expects($this->any())->method('pushHandler')->willReturnSelf();
     $this->logger->expects($this->once())->method('pushProcessor')->with([$this->messageProcessor, 'setExtra'])->willReturnSelf();
     $this->consoleHandler->expects($this->once())->method('setLevel')->willReturnSelf($logLevelCode);
     $this->consoleHandler->expects($this->once())->method('setFormatter')->with($this->messageFormatter)->willReturnSelf();
     $this->fileHandler->expects($this->once())->method('setLevel')->willReturnSelf();
     $this->fileHandler->expects($this->once())->method('setFormatter')->with($this->messageFormatter)->willReturnSelf();
     $this->manager->process($logLevel);
 }
Example #2
0
 public function testHandleRed()
 {
     $message = 'Colorized message';
     $record = ['message' => $message, 'level' => 400, 'extra' => []];
     $this->consoleHandler->setLevel(100);
     ob_start();
     $result = $this->consoleHandler->handle($record);
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertFalse($result);
     $this->assertContains('Colorized message', $output);
 }