function testEscapingSpecialChars() { $expected = <<<XML <?xml version="1.0" encoding="UTF-8"?> <root> <stuff><>&'"</stuff> </root> XML; $xml = Braintree_Xml::buildXmlFromArray(array('root' => array('stuff' => '<>&\'"'))); $this->assertEquals($expected, $xml); }
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); }