assertTrue(\SiWeather\Webservice\GeoLocator::configured()); } /** * @dataProvider testLocations_data */ public function testLocations($latiude, $longitude, $radius, $results){ $errorMessage = ""; $locations = \SiWeather\Webservice\GeoLocator::locations($latiude, $longitude, $radius, $errorMessage); $this->assertInternalType("array", $locations, $errorMessage); $this->assertTrue(empty($errorMessage)); $this->assertEquals(count($locations), count($results)); for($i = 0; $i < count($locations); $i++){ $this->assertEquals($locations[$i]->city(), $results[$i]->city()); $this->assertEquals($locations[$i]->postalCode(), $results[$i]->postalCode()); $this->assertEquals($locations[$i]->regionName(), $results[$i]->regionName()); $this->assertEquals($locations[$i]->regionCode(), $results[$i]->regionCode()); $this->assertEquals($locations[$i]->countryName(), $results[$i]->countryName()); $this->assertEquals($locations[$i]->countryCode(), $results[$i]->countryCode()); $this->assertEquals($locations[$i]->latitude(), $results[$i]->latitude()); $this->assertEquals($locations[$i]->longitude(), $results[$i]->longitude()); $this->assertEquals($locations[$i]->locationWkt(), $results[$i]->locationWkt()); $this->assertEquals($locations[$i]->timeZone(), $results[$i]->timeZone()); } } public function testLocations_data(){ $radius = 5; $result = array(); $result[] = array ( 51.828056, 10.2825, $radius, array ( new \SiWeather\Webservice\Location("Wildemann", "", "Niedersachsen", "06", "Deutschland", "DE", 51.8281, 10.28152, "Europe/Berlin"), new \SiWeather\Webservice\Location("Bad Grund", "", "Niedersachsen", "06", "Deutschland", "DE", 51.81021, 10.23694, "Europe/Berlin"), new \SiWeather\Webservice\Location("Zellerfeld", "", "Niedersachsen", "06", "Deutschland", "DE", 51.81846, 10.33532, "Europe/Berlin"), new \SiWeather\Webservice\Location("Clausthal-Zellerfeld", "", "Niedersachsen", "06", "Deutschland", "DE", 51.80949, 10.33821, "Europe/Berlin"), new \SiWeather\Webservice\Location("Clausthal", "", "Niedersachsen", "06", "Deutschland", "DE", 51.80441, 10.33384, "Europe/Berlin"), new \SiWeather\Webservice\Location("Hahnenklee-Bockswiese", "", "Niedersachsen", "06", "Deutschland", "DE", 51.85487, 10.33178, "Europe/Berlin"), new \SiWeather\Webservice\Location("Lautenthal", "", "Niedersachsen", "06", "Deutschland", "DE", 51.86934, 10.28741, "Europe/Berlin"), new \SiWeather\Webservice\Location("Laubhütte", "", "Niedersachsen", "06", "Deutschland", "DE", 51.79609, 10.23479, "Europe/Berlin"), ) ); return $result; } } ?>