1414
1515use Geocoder \IntegrationTest \BaseTestCase ;
1616use Geocoder \Provider \Photon \Photon ;
17+ use Geocoder \Provider \Photon \Model \PhotonAddress ;
1718use Geocoder \Query \GeocodeQuery ;
1819use Geocoder \Query \ReverseQuery ;
1920
@@ -97,7 +98,8 @@ public function testGeocodeQueryWithNamedResult()
9798 public function testReverseQuery ()
9899 {
99100 $ provider = Photon::withKomootServer ($ this ->getHttpClient ());
100- $ results = $ provider ->reverseQuery (ReverseQuery::fromCoordinates (52 , 10 ));
101+ $ reverseQuery = ReverseQuery::fromCoordinates (52 , 10 )->withLimit (1 );
102+ $ results = $ provider ->reverseQuery ($ reverseQuery );
101103
102104 $ this ->assertInstanceOf ('Geocoder\Model\AddressCollection ' , $ results );
103105 $ this ->assertCount (1 , $ results );
@@ -121,16 +123,19 @@ public function testReverseQuery()
121123 $ this ->assertEquals ('Sehlem ' , $ result ->getDistrict ());
122124 }
123125
124- public function testReverseQueryWithOsmDataFilter ()
126+ public function testReverseQueryWithOsmTagFilter ()
125127 {
126128 $ provider = Photon::withKomootServer ($ this ->getHttpClient ());
127- $ reverseQuery = ReverseQuery::fromCoordinates (45.73179 , 6.03248 )
128- ->withData ('query_string_filter ' , 'osm_key:place ' )
129- ->withLimit (1 );
130- /** @var \Geocoder\Provider\Photon\Model\PhotonAddress $result */
131- $ result = $ provider ->reverseQuery ($ reverseQuery )->first ();
132-
133- $ this ->assertEquals ('place ' , $ result ->getOSMTag ()->key );
134- $ this ->assertEquals ('locality ' , $ result ->getOSMTag ()->value );
129+ $ reverseQuery = ReverseQuery::fromCoordinates (52.51644 , 13.38890 )
130+ ->withData ('osm_tag ' , 'amenity:pharmacy ' )
131+ ->withLimit (3 );
132+ $ results = $ provider ->reverseQuery ($ reverseQuery );
133+
134+ $ this ->assertCount (3 , $ results );
135+ foreach ($ results as $ result ) {
136+ $ this ->assertInstanceOf (PhotonAddress::class, $ result );
137+ $ this ->assertEquals ('amenity ' , $ result ->getOSMTag ()->key );
138+ $ this ->assertEquals ('pharmacy ' , $ result ->getOSMTag ()->value );
139+ }
135140 }
136141}
0 commit comments