public function testCreateAllowEmpty() { $code = 200; $rawResult = ''; $response = new Response(array('allow_body_empty' => true)); $response->create($code, $rawResult); $this->assertTrue($response->isOk()); $this->assertEquals($rawResult, $response->getRawResult()); $this->assertEquals($rawResult, $response->getResult()); $this->assertTrue($response->getConfig('allow_body_empty')); }
public function testCreateWithError() { $code = 403; $rawResult = '{"code":4000,"message":"error_test"}'; $response = new Response(); $response->create($code, $rawResult); $this->assertEquals('json', $response->getConfig('datatype')); $this->assertFalse($response->isOk()); $this->assertEquals($rawResult, $response->getRawResult()); $error = $response->getError(); $this->assertEquals('API_RETURN_ERROR_CODE', $error); }