/**
  * @dataProvider apiMethodsProvider
  */
 public function testGenerateUrlGeneratesSameUrlsApiCallsShouldUse($method, $params, $format, $resultFormat)
 {
     $service = new Robo47_Service_Bitly('login', 'apiKey', $format, $resultFormat);
     $this->_adapter->setResponse($this->getResponse($format, $method));
     $result = call_user_func_array(array($service, $method), $params);
     $methods = array('shorten' => Robo47_Service_Bitly::API_PATH_SHORTEN, 'expandByHash' => Robo47_Service_Bitly::API_PATH_EXPAND, 'expandByShortUrl' => Robo47_Service_Bitly::API_PATH_EXPAND, 'infoByHash' => Robo47_Service_Bitly::API_PATH_INFO, 'infoByHashWithKeys' => Robo47_Service_Bitly::API_PATH_INFO, 'infoByShortUrl' => Robo47_Service_Bitly::API_PATH_INFO, 'infoByShortUrlWithKeys' => Robo47_Service_Bitly::API_PATH_INFO, 'statsByHash' => Robo47_Service_Bitly::API_PATH_STATS, 'statsByShortUrl' => Robo47_Service_Bitly::API_PATH_STATS, 'errors' => Robo47_Service_Bitly::API_PATH_ERRORS);
     if (!isset($methods[$method])) {
         $this->fail('invalid Method: ' . $method);
     }
     $urlParams = $params;
     if (isset($urlParams['keys'])) {
         $urlParams['keys'] = implode(',', $urlParams['keys']);
     }
     $generatedUrl = parse_url($service->generateUrl($methods[$method], $urlParams));
     $url = parse_url($service->getHttpClient()->getUri()->getUri());
     foreach ($generatedUrl as $key => $value) {
         $this->assertEquals($generatedUrl[$key], $url[$key], 'Urls don\'t match in part:' . $key);
     }
 }