/** * @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); }
/** * @group ZF-2062 * @group ZF-4190 */ public function testFixingBrokenCharsSoXmlIsValid() { $f = new XmlFormatter(); $line = $f->format(array('message' => '&', 'priority' => 42)); $this->assertContains('&amp', $line); }
/** * @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)); }
/** * @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); }