public function testArrayResponse() { $request = new Requester(); $request->setOptionResponseType(Requester::RESPONSE_ARRAY); $result = $request->get('http://httpbin.org/get'); $this->assertTrue(is_array($result), 'Must be an array'); $this->assertEquals($result['url'], 'http://httpbin.org/get', 'Url should be http://httpbin.org/get'); $this->assertEquals($result['http_code'], 200); $this->assertTrue(isset($result['headers'])); $this->assertTrue(isset($result['content'])); $jsonParsed = json_decode($result['content']); $this->assertNotNull($jsonParsed); $this->assertEquals($jsonParsed->url, 'http://httpbin.org/get', 'Url is not in the response'); //Back to String $request->setOptionResponseType(Requester::RESPONSE_RAW); $result = $request->get('http://httpbin.org/get'); $this->assertTrue(is_string($result), 'Must be an String'); }