Skip to content

Commit

Permalink
Merge pull request #48 from vicchi/gg-baidu-fixes
Browse files Browse the repository at this point in the history
Fix broken unit tests for Baidu (via PR #33)
  • Loading branch information
Nyholm committed Oct 17, 2016
2 parents 5ab1fa7 + 1203644 commit 0720930
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Geocoder/Provider/BaiduProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class BaiduProvider extends AbstractHttpProvider implements Provider
/**
* @var string
*/
const GEOCODE_ENDPOINT_URL = 'http://api.map.baidu.com/geocoder?output=json&key=%s&address=%s';
const GEOCODE_ENDPOINT_URL = 'http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=%s&address=%s';

/**
* @var string
*/
const REVERSE_ENDPOINT_URL = 'http://api.map.baidu.com/geocoder?output=json&key=%s&location=%F,%F';
const REVERSE_ENDPOINT_URL = 'http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=%s&location=%F,%F';

/**
* @var string
Expand Down
12 changes: 6 additions & 6 deletions tests/Geocoder/Tests/Provider/BaiduProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testGeocodeWithNullApiKey()

/**
* @expectedException \Geocoder\Exception\NoResult
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder?output=json&key=api_key&address=
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=api_key&address=
*/
public function testGeocodeWithNull()
{
Expand All @@ -37,7 +37,7 @@ public function testGeocodeWithNull()

/**
* @expectedException \Geocoder\Exception\NoResult
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder?output=json&key=api_key&address=
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=api_key&address=
*/
public function testGeocodeWithEmpty()
{
Expand All @@ -47,7 +47,7 @@ public function testGeocodeWithEmpty()

/**
* @expectedException \Geocoder\Exception\NoResult
* @expectedExceptionMessage ould not execute query http://api.map.baidu.com/geocoder?output=json&key=api_key&address=%E7%99%BE%E5%BA%A6%E5%A4%A7%E5%8E%A6
* @expectedExceptionMessage ould not execute query http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=api_key&address=%E7%99%BE%E5%BA%A6%E5%A4%A7%E5%8E%A6
*/
public function testGeocodeWithAddressContentReturnNull()
{
Expand All @@ -57,7 +57,7 @@ public function testGeocodeWithAddressContentReturnNull()

/**
* @expectedException \Geocoder\Exception\NoResult
* @expectedExceptionMessage ould not execute query http://api.map.baidu.com/geocoder?output=json&key=api_key&address=%E7%99%BE%E5%BA%A6%E5%A4%A7%E5%8E%A6
* @expectedExceptionMessage ould not execute query http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=api_key&address=%E7%99%BE%E5%BA%A6%E5%A4%A7%E5%8E%A6
*/
public function testGeocodeWithAddress()
{
Expand Down Expand Up @@ -117,7 +117,7 @@ public function testGeocodeWithRealAddress()

/**
* @expectedException Geocoder\Exception\NoResult
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder?output=json&key=api_key&location=1.000000,2.000000
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=api_key&location=1.000000,2.000000
*/
public function testReverse()
{
Expand All @@ -137,7 +137,7 @@ public function testReverseWithoutApiKey()

/**
* @expectedException \Geocoder\Exception\NoResult
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder?output=json&key=api_key&location=39.983424,116.322987
* @expectedExceptionMessage Could not execute query http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=api_key&location=39.983424,116.322987
*/
public function testReverseWithCoordinatesContentReturnNull()
{
Expand Down

0 comments on commit 0720930

Please sign in to comment.