From: Evan Prodromou Date: Thu, 22 Oct 2009 20:19:25 +0000 (-0400) Subject: beginning of a test for location services X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8828bc485f4dcc15be0437ae214a8690634df438;p=quix0rs-gnu-social.git beginning of a test for location services --- diff --git a/tests/LocationTest.php b/tests/LocationTest.php new file mode 100644 index 0000000000..62849eb9f4 --- /dev/null +++ b/tests/LocationTest.php @@ -0,0 +1,87 @@ +assertEquals($result, $location); + } + + static public function locationNames() + { + return array(array('Montreal', 'en', null), + array('San Francisco, CA', 'en', null), + array('Paris, France', 'en', null), + array('Paris, Texas', 'en', null)); + } + + /** + * @dataProvider locationIds + */ + + public function testLocationFromId($id, $ns, $language, $location) + { + $result = Location::fromId($id, $ns, $language); + $this->assertEquals($result, $location); + } + + static public function locationIds() + { + return array(array(6077243, GeonamesPlugin::NAMESPACE, 'en', null), + array(5391959, GeonamesPlugin::NAMESPACE, 'en', null)); + } + + /** + * @dataProvider locationLatLons + */ + + public function testLocationFromLatLon($lat, $lon, $language, $location) + { + $result = Location::fromLatLon($lat, $lon, $language); + $this->assertEquals($result, $location); + } + + static public function locationLatLons() + { + return array(array(37.77493, -122.41942, 'en', null), + array(45.509, -73.588, 'en', null)); + } + + /** + * @dataProvider nameOfLocation + */ + + public function testLocationGetName($location, $language, $name) + { + $result = $location->getName($language); + $this->assertEquals($result, $name); + } + + static public function nameOfLocation() + { + return array(array(new Location(), 'en', 'Montreal'), + array(new Location(), 'fr', 'Montréal')); + } +} +