/** * @dataProvider jsonProvider */ public function testDecode($input, $asArray, $expected) { $this->assertEquals($expected, JsonDecoder::decode($input, $asArray)); }
/** * @param string $method * @param string $host * @param string $path * @param array $parameters * * @return array|object */ private function http($method, $host, $path, array $parameters) { $this->resetLastResponse(); $url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path); $this->response->setApiPath($path); $result = $this->oAuthRequest($url, $method, $parameters); // return response as JSON or decode it? $response = $this->decodeJson ? JsonDecoder::decode($result, $this->decodeJsonAsArray) : $result; $this->response->setBody($response); return $response; }