public function testUrlGeneration() { // Test normal URL generation $defaults = array('language' => 'en', 'sensor' => 'false'); $format = 'json'; $location = 'Dallas, TX'; $params = array_merge($defaults, array('address' => $location)); $this->assertEquals("http://maps.googleapis.com/maps/api/geocode/{$format}?" . http_build_query($params, '', '&'), $this->service->generateUrl($location, $format), 'URLs did not match'); // Test with explicitly set defaults $defaults['language'] = 'fr'; $this->service->setRequestDefaults(array('language' => 'fr')); $params = array_merge($defaults, array('address' => $location)); $this->assertEquals("http://maps.googleapis.com/maps/api/geocode/{$format}?" . http_build_query($params, '', '&'), $this->service->generateUrl($location, $format), 'URLs did not match'); // Test reverse geocode generation $lat = 32.862811; $lng = -96.93970400000001; $params = array_merge($defaults, array('latlng' => "{$lat},{$lng}")); $this->assertEquals("http://maps.googleapis.com/maps/api/geocode/{$format}?" . http_build_query($params, '', '&'), $this->service->generateReverseUrl($lat, $lng, $format), 'URLs did not match'); }