function testEscapingSpecialChars()
    {
        $expected = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
 <stuff>&lt;&gt;&amp;'&quot;</stuff>
</root>

XML;
        $xml = Braintree_Xml::buildXmlFromArray(array('root' => array('stuff' => '<>&\'"')));
        $this->assertEquals($expected, $xml);
    }
Exemplo n.º 2
0
 private static function _buildXml($params)
 {
     return empty($params) ? null : Braintree_Xml::buildXmlFromArray($params);
 }
 function testIncludesTheEncodingRoundtrip()
 {
     $array = array('root' => array('root' => 'bar'));
     $xml = Braintree_Xml::buildXmlFromArray($array);
     $this->assertRegExp('<\\?xml version=\\"1.0\\" encoding=\\"UTF-8\\"\\?>', $xml);
 }