public function testCreate() { $code = 200; $rawResult = '{"RequestId": "4C467B38-3910-447D-87BC-AC049166F216"}'; $response = new ResponseJsonObject(); $response->create($code, $rawResult); $this->assertTrue($response->isOk()); $this->assertEquals($rawResult, $response->getRawResult()); $result = $response->getResult(); $this->assertObjectHasAttribute('RequestId', $result); $this->assertObjectNotHasAttribute('Code', $result); }
public function testCreate() { $code = 200; $rawResult = '{"time_get_response":{"time":"2015-09-16 15:53:37","request_id":"alibabaalibabaalibaba"}}'; $response = new ResponseJsonObject(); $response->create($code, $rawResult); $this->assertTrue($response->isOk()); $this->assertEquals($rawResult, $response->getRawResult()); $result = $response->getResult(); $this->assertObjectHasAttribute('time', $result); $this->assertObjectNotHasAttribute('code', $result); }