Skip to content

Fix broken unit tests for Baidu (via PR #33) #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 17, 2016

Conversation

vicchi
Copy link
Member

@vicchi vicchi commented Oct 16, 2016

As noted in #33 (comment), the pull request as submitted broke the unit tests. This PR incorporates the code changes to BaiduProvider.php as well as fixing up the unit tests as a result of the changed endpoint URLs for v2 of Baidu's geocoding API.

@Nyholm
Copy link
Member

Nyholm commented Oct 16, 2016

Awesome work. Am I correct if I say that nothing has changed in the Baidu API from version 1 to 3 regarding geocoding and reverse geocoding?

@vicchi
Copy link
Member Author

vicchi commented Oct 16, 2016

@Nyholm version 1 and version 3 of what? Sorry, don't follow you

But to clarify. This PR is a manual merge of #33 with no changes to the geocoding source code plus the fixes needed to get Baidu's unit tests to build clean.

If that helps!

@Nyholm
Copy link
Member

Nyholm commented Oct 17, 2016

I see that this PR updates the version of Baidu API.

$before = 'http://api.map.baidu.com/geocoder?output=json&key=%s&address=%s';
$after  = 'http://api.map.baidu.com/geocoder/v2/?output=json&pois=0&ak=%s&address=%s';

What have changed on the Baido API server between those releases? Did the change effect the geocode or reverse geocode endpoints?

@vicchi
Copy link
Member Author

vicchi commented Oct 17, 2016

@Nyholm Ah. I see what you mean now. The changes to the API endpoints were made in PR #33 and I manually merged that PR into my checked out repo before creating this PR.

The only change on Baidu's end is the URL endpoint, from api.map.baidu.com/geocoder to api.map.baidu.com/geocoder/v2 and also of the inclusion of the pois=0 query string parameter. The payload returned by the Baidu API appears to be consistent between the v1 and v2 endpoints.

The main reason behind PR #48 (this PR), is that the original PR changed the provider's code, but did not change/fix up the unit tests (if indeed they were ever run).

So this PR incorporates and obsoletes PR #33 as well as adding the fixes to get the unit tests to build cleanly again. So when we merge this PR, we'll need to close down #33 as well, but not merge #33.

If that all makes sense?

@Nyholm
Copy link
Member

Nyholm commented Oct 17, 2016

Yes, Everything makes perfect sense. It was this I was looking for:

The only change on Baidu's end is the URL endpoint, from api.map.baidu.com/geocoder to api.map.baidu.com/geocoder/v2 and also of the inclusion of the pois=0 query string parameter. The payload returned by the Baidu API appears to be consistent between the v1 and v2 endpoints.

@Nyholm Nyholm merged commit 0720930 into geocoder-php:master Oct 17, 2016
@Nyholm
Copy link
Member

Nyholm commented Oct 17, 2016

Thank you for your work.

@vicchi
Copy link
Member Author

vicchi commented Oct 17, 2016

Awesome. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants