setCity($value); $this->assertEquals($location->city(), $value); } public function testPostalCode(){ $location = new \SiWeather\Webservice\Location("", ""); $value = "12345"; $location->setPostalCode($value); $this->assertEquals($location->postalCode(), $value); } public function testRegion(){ $location = new \SiWeather\Webservice\Location("", ""); $value1 = "Wallhall"; $value2 = "WH"; $location->setRegion($value1, $value2); $this->assertEquals($location->regionName(), $value1); $this->assertEquals($location->regionCode(), $value2); } public function testCountry(){ $location = new \SiWeather\Webservice\Location("", ""); $value1 = "Wallhall"; $value2 = "WH"; $location->setCountry($value1, $value2); $this->assertEquals($location->countryName(), $value1); $this->assertEquals($location->countryCode(), $value2); } public function testValidLatitude_data(){ $result = array(); $result[] = array(null, false); $result[] = array("asdasd", false); $result[] = array(0, true); $result[] = array(-90, true); $result[] = array(90, true); $result[] = array(85.1234, true); $result[] = array(-90.0001, false); $result[] = array(90.0001, false); return $result; } /** * @dataProvider testValidLatitude_data */ public function testValidLatitude($latitude, $result){ $this->assertEquals(\SiWeather\Webservice\Location::validLatitude($latitude), $result); } public function testValidLongitude_data(){ $result = array(); $result[] = array(null, false); $result[] = array("asdasd", false); $result[] = array(0, true); $result[] = array(-90, true); $result[] = array(90, true); $result[] = array(85.1234, true); $result[] = array(-180.0001, false); $result[] = array(180.0001, false); return $result; } /** * @dataProvider testValidLongitude_data */ public function testValidLongitude($longitude, $result){ $this->assertEquals(\SiWeather\Webservice\Location::validLongitude($longitude), $result); } public function testLocation(){ $location = new \SiWeather\Webservice\Location("", ""); $latitude = -59.0; $longitude = 33; $location->setLocation($latitude, $longitude); $this->assertEquals($location->latitude(), $latitude); $this->assertEquals($location->longitude(), $longitude); $this->assertEquals($location->locationWKT(), $longitude ." ". $latitude); } public function testTimeZone(){ $location = new \SiWeather\Webservice\Location("", ""); $value = "Europe/Berlin"; $location->setTimeZone($value); $this->assertEquals($location->timeZone(), $value); } public function constructor(){ $city = "Nice Place"; $postalCode = "0001"; $regionName = "Nice Region"; $regionCode = "NR"; $countryName = "Nice Country"; $countryCode = "NC"; $longitude = 50; $latitude = 20; $location = new \SiWeather\Webservice\Location($city, $postalCode, $regionName, $regionCode, $countryName, $countryCode, $latitude, $longitude); $this->assertEquals($location->city(), $city); $this->assertEquals($location->postalCode(), $postalCode); $this->assertEquals($location->regionName(), $regionName); $this->assertEquals($location->regionCode(), $regionCode); $this->assertEquals($location->countryName(), $countryName); $this->assertEquals($location->countryCode(), $countryCode); $this->assertEquals($location->latitude(), $latitude); $this->assertEquals($location->longitude(), $longitude); $this->assertEquals($location->locationWkt(), $longitude ." ". $latitude); } } ?>