コード例 #1
0
ファイル: LogTest.php プロジェクト: bradley-holt/zf2
 /**
  * @group ZF-9790
  */
 public function testInitializationWithFilterAndFormatter()
 {
     $stream = fopen('php://memory', 'w+');
     $options = array('memory' => array('writerName' => 'Stream', 'writerParams' => array('stream' => $stream), 'filterName' => 'Priority', 'filterParams' => array('priority' => \Zend\Log\Logger::INFO), 'formatterName' => 'Simple', 'formatterParams' => array('format' => '%timestamp%: %message%')));
     $message = 'tottakai';
     $resource = new LogResource($options);
     $resource->setBootstrap($this->bootstrap);
     $log = $resource->init();
     $this->assertInstanceOf('Zend\\Log\\Logger', $log);
     $log->log($message, \Zend\Log\Logger::INFO);
     rewind($stream);
     $contents = stream_get_contents($stream);
     $this->assertStringEndsWith($message, $contents);
     $this->assertRegexp('/\\d\\d:\\d\\d:\\d\\d/', $contents);
 }
コード例 #2
0
ファイル: LogTest.php プロジェクト: rexmac/zf2
 /**
  * @group ZF-8602
  */
 public function testNumericLogStreamFilterParamsPriorityDoesNotFail()
 {
     $options = array('stream' => array('writerName' => 'Stream', 'writerParams' => array('stream' => "php://memory", 'mode' => 'a'), 'filterName' => 'Priority', 'filterParams' => array('priority' => 4)));
     $resource = new LogResource($options);
     $resource->setBootstrap($this->bootstrap);
     $resource->init();
 }