示例#1
0
 public function testArrayClassConversion()
 {
     $o = new ArrayClass();
     $o->setName("test");
     $o->setDescription("description");
     $o->setTags(array('payment', 'info', 'test'));
     $this->assertEquals("test", $o->getName());
     $this->assertEquals("description", $o->getDescription());
     $this->assertEquals(array('payment', 'info', 'test'), $o->getTags());
     $json = $o->toJSON();
     $this->assertEquals('{"name":"test","desc":"description","tags":["payment","info","test"]}', $json);
     $newO = new ArrayClass();
     $newO->fromJson($json);
     $this->assertEquals($o, $newO);
 }