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'); }
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()); }