13
13
namespace Geocoder \Provider \Photon \Tests ;
14
14
15
15
use Geocoder \IntegrationTest \BaseTestCase ;
16
+ use Geocoder \Provider \Photon \Model \PhotonAddress ;
16
17
use Geocoder \Query \GeocodeQuery ;
17
18
use Geocoder \Query \ReverseQuery ;
18
19
use Geocoder \Provider \Photon \Photon ;
@@ -97,7 +98,8 @@ public function testGeocodeQueryWithNamedResult()
97
98
public function testReverseQuery ()
98
99
{
99
100
$ 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 );
101
103
102
104
$ this ->assertInstanceOf ('Geocoder\Model\AddressCollection ' , $ results );
103
105
$ this ->assertCount (1 , $ results );
@@ -121,16 +123,19 @@ public function testReverseQuery()
121
123
$ this ->assertEquals ('Sehlem ' , $ result ->getDistrict ());
122
124
}
123
125
124
- public function testReverseQueryWithOsmDataFilter ()
126
+ public function testReverseQueryWithOsmTagFilter ()
125
127
{
126
128
$ 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
+ }
135
140
}
136
141
}
0 commit comments