コード例 #1
0
 public function it_can_search_with__query(Browser $client, Response $response)
 {
     $response->getContent()->shouldBeCalled();
     $client->get(sprintf('%s/search?%s', 'http://endpoint', http_build_query(['q' => 'pilkington avenue, birmingham', 'format' => 'json'])), ['User-Agent' => 'Nomatim PHP Library (https://github.com/nixilla/nominatim-consumer); email: not set'])->shouldBeCalled()->willReturn($response);
     $query = new Query();
     $query->setQuery('pilkington avenue, birmingham');
     $this->search($query)->shouldReturnAnInstanceOf('Nominatim\\Result\\Collection');
 }
コード例 #2
0
 protected function runStructuredQuery(Query $query)
 {
     $input = $query->getStructuredQuery() + ['format' => $this->getConverter()->getFormat()];
     $response = $this->client->get(sprintf('%s/search?%s', $this->endpoint, http_build_query($input)), $this->headers);
     return $this->getConverter()->convert($response->getContent());
 }