Exemple #1
0
 /**
  * @test
  */
 public function logEvents()
 {
     $output = '';
     $observer = function ($emitter, $event) use(&$output) {
         $output .= "#{$event}";
     };
     $this->logger->on('log', $observer);
     $this->logger->on('unhandled', $observer);
     $this->logger->on('unknown', $observer);
     $this->logger->on('alert', $observer);
     $this->logger->on('info', $observer);
     $this->logger->setHandler(new NullHandler(Level::ALERT));
     $this->logger->alert(__FUNCTION__);
     $this->logger->info(__FUNCTION__);
     $this->logger->log(0, '');
     $this->assertTrue(!!\preg_match('/^#log#alert#unhandled#unknown$/', $output));
 }
 /**
  * @test
  */
 public function handleTest2()
 {
     $this->logger->log(132, __FUNCTION__);
     $this->expectOutputRegex('/critical.+' . __FUNCTION__ . '.+debug.+' . __FUNCTION__ . '/sm');
 }