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