|
|
@@ -159,8 +159,36 @@ class Zend_Log_Formatter_XmlTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertContains($expected, $output);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @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);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class Zend_Log_Formatter_XmlTest_SerializableObject
|
|
|
+{
|
|
|
+ public function __toString()
|
|
|
+ {
|
|
|
+ return __CLASS__;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (PHPUnit_MAIN_METHOD == 'Zend_Log_Formatter_XmlTest::main') {
|
|
|
Zend_Log_Formatter_XmlTest::main();
|
|
|
-}
|
|
|
+}
|