Skip to content

Commit 0720930

Browse files
authored
Merge pull request #48 from vicchi/gg-baidu-fixes
Fix broken unit tests for Baidu (via PR #33)
2 parents 5ab1fa7 + 1203644 commit 0720930

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Geocoder/Provider/BaiduProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class BaiduProvider extends AbstractHttpProvider implements Provider
2323
/**
2424
* @var string
2525
*/
26-
const GEOCODE_ENDPOINT_URL = 'http://api.map.baidu.com/geocoder?output=json&key=%s&address=%s';
26+
const GEOCODE_ENDPOINT_URL = 'http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=%s&address=%s';
2727

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

3333
/**
3434
* @var string

tests/Geocoder/Tests/Provider/BaiduProviderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testGeocodeWithNullApiKey()
2727

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

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

4848
/**
4949
* @expectedException \Geocoder\Exception\NoResult
50-
* @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
50+
* @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
5151
*/
5252
public function testGeocodeWithAddressContentReturnNull()
5353
{
@@ -57,7 +57,7 @@ public function testGeocodeWithAddressContentReturnNull()
5757

5858
/**
5959
* @expectedException \Geocoder\Exception\NoResult
60-
* @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
60+
* @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
6161
*/
6262
public function testGeocodeWithAddress()
6363
{
@@ -117,7 +117,7 @@ public function testGeocodeWithRealAddress()
117117

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

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

0 commit comments

Comments
 (0)