Ejemplo n.º 1
0
 function testSerializeWithRootNodeMappingShouldThrowError()
 {
     $a = new Hypercharge\Address($this->address());
     $this->expectException(new PatternExpectation('/class "Address" has no root-name mapping/'));
     $serializer = new Hypercharge\XmlSerializer();
     $serializer->toXml($a);
 }
Ejemplo n.º 2
0
    function testSerialize()
    {
        $r = new Hypercharge\RiskParams(array('session_id' => '123'));
        $root = Hypercharge\XmlSerializer::createDocument('test');
        Hypercharge\XmlSerializer::_toXml($r, $root);
        $str = $root->ownerDocument->saveXML();
        $this->assertEqual('<?xml version="1.0" encoding="UTF-8"?>
<test>
  <session_id>123</session_id>
</test>
', $str);
    }