Example #1
0
 public function testXmlValidates()
 {
     $f = new Zend_Log_Formatter_Xml();
     $line = $f->format($message = 'message', $priority = 1);
     $sxml = @simplexml_load_string($line);
     $this->assertType('SimpleXMLElement', $sxml, 'Formatted XML is invalid');
 }
Example #2
0
 /**
  * @group ZF-11161
  */
 public function testObjectsWithStringSerializationAreIncludedInFormattedString()
 {
     $options = array('rootElement' => 'log');
     $event = array('message' => 'tottakai', 'priority' => 4, 'context' => array('test' => 'one'), 'reference' => new Zend_Log_Formatter_XmlTest_SerializableObject());
     $expected = '<log><message>tottakai</message><priority>4</priority><reference>Zend_Log_Formatter_XmlTest_SerializableObject</reference></log>';
     $formatter = new Zend_Log_Formatter_Xml($options);
     $output = $formatter->format($event);
     $this->assertContains($expected, $output);
 }
 /**
  * @group ZF-2062
  * @group ZF-4190
  */
 public function testFixingBrokenCharsSoXmlIsValid()
 {
     $f = new Zend_Log_Formatter_Xml();
     $line = $f->format(array('message' => '&amp', 'priority' => 42));
     $this->assertContains('&amp;amp', $line);
 }
Example #4
0
 /**
  * @group ZF-9176
  */
 public function testFactory()
 {
     $options = array('rootElement' => 'log', 'elementMap' => array('timestamp' => 'timestamp', 'response' => 'message'));
     $formatter = Zend_Log_Formatter_Xml::factory($options);
     $this->assertType('Zend_Log_Formatter_Xml', $formatter);
 }