Ejemplo n.º 1
0
 /**
  * If bubbling is set to false, _write() must return false, otherwise true
  */
 public function testBubbling()
 {
     $configNoBubbling = array('bubble' => false, 'url' => 'php://memory', 'filters' => array());
     $configWithBubbling = array('bubble' => true, 'url' => 'php://memory', 'filters' => array());
     $configWithBubblingByDefault = array('url' => 'php://memory', 'filters' => array());
     $configWithFaultyBubbleSetting = array('bubble' => 'yeeha!', 'url' => 'php://memory', 'filters' => array());
     $logEvent = LogEvent::create(ILogger::LEVEL_ERROR, 'Bubble Bobble', array(), 'PHPUnit');
     $noBubbleWriter = new NoWriter($configNoBubbling);
     $configuredBubbleWriter = new NoWriter($configWithBubbling);
     $defaultBubbleWriter = new NoWriter($configWithBubblingByDefault);
     $wrongConfiguredBubbleWriter = new NoWriter($configWithFaultyBubbleSetting);
     $this->assertFalse($noBubbleWriter->log($logEvent));
     $this->assertTrue($configuredBubbleWriter->log($logEvent));
     $this->assertTrue($defaultBubbleWriter->log($logEvent));
     $this->assertTrue($wrongConfiguredBubbleWriter->log($logEvent));
 }
Ejemplo n.º 2
0
 /**
  * Provide a config array and have filters built
  */
 public function testBuildProcessorsFromConfig()
 {
     $config = array('url' => 'php://memory', 'filters' => array(), 'processors' => array(array('\\Zalora\\Punyan\\Processor\\NoOp' => array()), array('NoOp' => array())));
     $writer = new NoWriter($config);
     $processors = $writer->getProcessors();
     $this->assertCount(2, $processors);
     foreach ($processors as $processor) {
         $this->assertInstanceOf('\\Zalora\\Punyan\\Processor\\IProcessor', $processor);
     }
 }