예제 #1
0
 public function testConstructorWithArray()
 {
     $options = array('rootElement' => 'log', 'elementMap' => array('word' => 'message', 'priority' => 'priority'));
     $event = array('message' => 'tottakai', 'priority' => 4);
     $expected = '<log><word>tottakai</word><priority>4</priority></log>';
     $formatter = new XmlFormatter($options);
     $output = $formatter->format($event);
     $this->assertContains($expected, $output);
     $this->assertEquals('UTF-8', $formatter->getEncoding());
 }
예제 #2
0
 public function testConstructorWithArray()
 {
     $date = new DateTime();
     $options = array('rootElement' => 'log', 'elementMap' => array('date' => 'timestamp', 'word' => 'message', 'priority' => 'priority'), 'dateTimeFormat' => 'r');
     $event = array('timestamp' => $date, 'message' => 'tottakai', 'priority' => 4);
     $expected = sprintf('<log><date>%s</date><word>tottakai</word><priority>4</priority></log>', $date->format('r'));
     $formatter = new XmlFormatter($options);
     $output = $formatter->format($event);
     $this->assertContains($expected, $output);
     $this->assertEquals('UTF-8', $formatter->getEncoding());
 }