Skip to content

Conversation

@mvcaaa
Copy link

@mvcaaa mvcaaa commented Oct 30, 2015

Fully based on pull/427

Tests added
Some fixes to original code

Closes #426

.gitignore Outdated
Copy link
Member

Choose a reason for hiding this comment

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

This should go to your global gitignore.

@willdurand
Copy link
Member

@geocoder-php/geocoder WDYT?

@dereuromark
Copy link

Useful addition! 👍

@toin0u
Copy link
Member

toin0u commented Feb 9, 2016

It's a good addition - the component filters improve really the result :) 👍

@willdurand
Copy link
Member

@mvcaaa could you rebase this PR please?

@mvcaaa
Copy link
Author

mvcaaa commented Jul 18, 2016

@willdurand Done

@willdurand
Copy link
Member

willdurand commented Jul 18, 2016

@mvcaaa sorry to bother you one more time, but could you please:

  1. remove this commit 50dfe81
  2. squash your commits to a single one with a new commit message?

Thank you!

@mvcaaa
Copy link
Author

mvcaaa commented Nov 8, 2016

Any feedback ?

@Nyholm
Copy link
Member

Nyholm commented Dec 22, 2016

I know it has been a while since this PR was submitted. But I can't find the documentation of component filtering. The link you provided does not work... (or Im blind)
https://developers.google.com/maps/documentation/geocoding/#ComponentFiltering

@LordBaine2000
Copy link

LordBaine2000 commented Dec 22, 2016

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Great. I like this PR. But I think we test the wrong things. We could only mock the message factory and validate the URL and we would be good.


/**
* @param string $query
* @return \Geocoder\Model\AddressCollection
Copy link
Member

Choose a reason for hiding this comment

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

Remove this. It is not a part of the PR and it is no longer valid.

$provider->geocode('10 avenue Gambetta, Paris, France');
}

public function testGeocodeWithValidComponentFilters()
Copy link
Member

Choose a reason for hiding this comment

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

Would this test be different without setComponentFilters?

I suggest that you only write a unit test that make sure the correct parameters is added on the URL. We already have functional tests that make sure the response handing is proper.

Copy link
Author

Choose a reason for hiding this comment

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

ComponentFilters are 100% optional - so without it this test will not be different, but it will fail 100%

Not sure how i can redo this - any suggestions are welcome.

Copy link
Member

Choose a reason for hiding this comment

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

Instead of doing this functional tests we could do unit tests that verifies that the query URL has changed when using setComponentFilters. We do not actually need to execute the query and verify the result.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are 100% right, but
Here is my concern: query is formed by private function buildQuery(and only there). I can test it, but it isn the perfect solution, kind of, i think

Copy link
Member

Choose a reason for hiding this comment

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

What if you mock the HttpClient and verify that the sendRequest function has a request with the preferred query?

Copy link
Author

Choose a reason for hiding this comment

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

It can be done, sure. Will do if no one was willing to disagree or suggest something better.
I think, buildQuery must be refactored also - but i will not do that. It is way outside my small tiny PR.

Copy link
Member

Choose a reason for hiding this comment

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

I think, buildQuery must be refactored also - but i will not do that. It is way outside my small tiny PR.

Yes it is outside the scope.

I do not think you have to refactor anything. Just update the test code.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mvcaaa i did something silimar for googles result_type & location_type and wrote a unittest that checks the url.
Check out here: https://github.com/arubacao/Geocoder/blob/8f322d551b486c8c3bf6fd7fe84caaec6364797e/tests/Geocoder/Tests/Provider/GoogleMapsTest.php#L304

}

/**
* Add components for filtering.
Copy link
Member

Choose a reason for hiding this comment

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

Really good that you provide the link, but it should be updated.

}

/**
* @param $region
Copy link
Member

Choose a reason for hiding this comment

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

This doc block is not part of the PR. You can keep this but try to avoid "code cleanups" in the same PR as features.

@Nyholm
Copy link
Member

Nyholm commented May 26, 2017

Ping, will you complete the work on this PR or should it be closed?

@Nyholm
Copy link
Member

Nyholm commented Jun 17, 2017

Im closing because inactivity. Feel free to create a new PR. I like this feature.

@Nyholm Nyholm closed this Jun 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google

8 participants