예제 #1
0
 public function testDataWithToStringObject()
 {
     $obj = new ToStringClass();
     $data = array('obj' => $obj);
     $resp = '<?xml version="1.0" encoding="UTF-8"?><user><obj>' . $obj->__toString() . '</obj></user>';
     $representation = new Xml();
     $representation->write(ResultSet::create($data, 'user'));
     self::assertEquals($this->removeXmlFormatting($resp), $this->removeXmlFormatting($representation->__toString()));
 }
예제 #2
0
 public function testDataWithToStringObject()
 {
     $obj = new ToStringClass();
     $data = array('obj' => $obj);
     $resp = '{"user":{"obj":"' . $obj->__toString() . '"}}';
     $representation = new Json();
     $representation->write(ResultSet::create($data, 'user'));
     $this->assertEquals($resp, $representation->__toString());
 }