예제 #1
0
 public function testNominatimFactory()
 {
     $guzzle = m::mock("GuzzleHttp\\Client");
     $baseSearch = new Search();
     $baseSearch->city("Zagreb");
     $instance = new Nominatim($guzzle, $baseSearch);
     $search = $instance->newSearch();
     $this->assertInstanceOf(Nominatim::class, $instance);
     $this->assertInstanceOf(Search::class, $search);
     $this->assertEquals($baseSearch, $search);
     $this->assertNotSame($baseSearch, $search);
     $this->assertSame($guzzle, $instance->getClient());
 }
예제 #2
0
 /**
  * Runs the query and returns the result set from Nominatim.
  *
  * @return array The decoded data returned from Nominatim.
  */
 public function find(Search $search)
 {
     $response = $this->client->get('search', ['query' => $search->getQuery()]);
     return $response->json();
 }