예제 #1
0
 /**
  * @group ZF-11161
  */
 public function testObjectsWithStringSerializationAreIncludedInFormattedString()
 {
     $options = array('rootElement' => 'log');
     $event = array('message' => 'tottakai', 'priority' => 4, 'context' => array('test' => 'one'), 'reference' => new SerializableObject());
     $expected = '<log><message>tottakai</message><priority>4</priority><reference>ZendTest\\Log\\TestAsset\\SerializableObject</reference></log>';
     $formatter = new XmlFormatter($options);
     $output = $formatter->format($event);
     $this->assertContains($expected, $output);
 }
예제 #2
0
 /**
  * @group ZF-2062
  * @group ZF-4190
  */
 public function testFixingBrokenCharsSoXmlIsValid()
 {
     $f = new XmlFormatter();
     $line = $f->format(array('message' => '&amp', 'priority' => 42));
     $this->assertContains('&amp;amp', $line);
 }
예제 #3
0
 /**
  * @group ZF2-453
  */
 public function testFormatWillRemoveExtraEmptyArrayFromEvent()
 {
     $formatter = new XmlFormatter();
     $d = new DateTime('2001-01-01T12:00:00-06:00');
     $event = array('timestamp' => $d, 'message' => 'test', 'priority' => 1, 'priorityName' => 'CRIT', 'extra' => array());
     $expected = '<logEntry><timestamp>2001-01-01T12:00:00-06:00</timestamp><message>test</message><priority>1</priority><priorityName>CRIT</priorityName></logEntry>';
     $expected .= PHP_EOL . PHP_EOL;
     $this->assertEquals($expected, $formatter->format($event));
 }
예제 #4
0
 /**
  * @group ZF-9176
  */
 public function testFactory()
 {
     $options = array(
         'rootElement' => 'log',
         'elementMap' => array(
             'timestamp' => 'timestamp',
             'response' => 'message'
         )
     );
     $formatter = XmlFormatter::factory($options);
     $this->assertInstanceOf('Zend\Log\Formatter\Xml', $formatter);
 }