Skip to content

MapQuest Provider Now Can use an API Key For NonOpen API - #234

Closed
DevOpsChris wants to merge 5 commits into
geocoder-php:masterfrom
DevOpsChris:master
Closed

DevOpsChris wants to merge 5 commits into
geocoder-php:masterfrom
DevOpsChris:master

Conversation

@DevOpsChris

Copy link
Copy Markdown

No tests were created, seemed too minor of
a tweak.

Just add the key as the second parameter if you have a key from www.mapquest.com.

No tests were created, seemed too minor of
a tweak.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should make the $locale nullable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a BC Break. It should be:

public function __construct(HttpAdapterInterface $adapter, $locale = null, $apiKey = null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah right

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, $locale will be null. I'm not sure what BC stands for, however, it seems what Baachi brought up, the constructor for BingMapsProvider will be a BC break too, for I copied by eye what the argument order was from that Provider.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BC = Build Commit?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BC means Backward Compatibility

@DevOpsChris

Copy link
Copy Markdown
Author

Ok, updated to reflect requested code changes. I just learned about Travis-CI and how this project is integrated with that system. That's beautiful. It seems there was a d/l issue with Php 5.4, the other versions were successful in the tests.

@willdurand

Copy link
Copy Markdown
Member

So, it's ok, now you have to write a unit test. Add the following test in the MapQuestProviderTest class:

    /**
     * @expectedException Geocoder\Exception\NoResultException
     * @expectedExceptionMessage Could not find results for given query: http://www.mapquestapi.com/geocoding/v1/address?location=foobar&outFormat=json&maxResults=1&key=my-api-key'
     */
    public function testGetGeocodedDataWithApiKey()
    {
        $provider = new MapQuestProvider($this->getMockAdapter(), 'my-api-key');
        $provider->getGeocodedData('foobar');
    }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it correct by the way? the "end" looks weird:

';//Fmjtd|luub2d6tl9%2C2s%3Do5-9u22lr';

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, good catch, I missed removing that during debugging.

@willdurand

Copy link
Copy Markdown
Member

@icedstitch see https://travis-ci.org/willdurand/Geocoder/jobs/7187899#L78, the test may be not correct, or there is an issue with your code not using the right URL

@DevOpsChris

Copy link
Copy Markdown
Author

Agreed, I noticed it's using, strangely, the wrong url. I'm not in a place to fix it til maybe tonight at the soonest.

@willdurand

Copy link
Copy Markdown
Member

Merged. Thank you!

@willdurand willdurand closed this May 21, 2013
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.

4 participants