| [db38696] | 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 4 |
|
|---|
| 5 | This library is free software; you can redistribute it and/or
|
|---|
| 6 | modify it under the terms of the GNU Lesser General Public
|
|---|
| 7 | License as published by the Free Software Foundation; either
|
|---|
| 8 | version 2.1 of the License, or (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This library is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 13 | Lesser General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU Lesser General Public
|
|---|
| 16 | License along with this library; if not, write to the Free Software
|
|---|
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|---|
| 18 | MA 02110-1301 USA.
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 | $file = __DIR__ ."/testconfig/testconfig.php";
|
|---|
| 22 | require($file);
|
|---|
| 23 | require($testconfig["webserviceDirectory"] ."/inc/envsetup.php");
|
|---|
| 24 |
|
|---|
| 25 | class LocationTest extends PHPUnit_Framework_TestCase
|
|---|
| 26 | {
|
|---|
| 27 | public function testCity(){
|
|---|
| 28 | $location = new \SiWeather\Webservice\Location("", "");
|
|---|
| 29 |
|
|---|
| 30 | $value = "testCity";
|
|---|
| 31 | $location->setCity($value);
|
|---|
| 32 | $this->assertEquals($location->city(), $value);
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | public function testZipCode(){
|
|---|
| 36 | $location = new \SiWeather\Webservice\Location("", "");
|
|---|
| 37 |
|
|---|
| 38 | $value = "12345";
|
|---|
| 39 | $location->setZipCode($value);
|
|---|
| 40 | $this->assertEquals($location->zipCode(), $value);
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | public function testRegion(){
|
|---|
| 44 | $location = new \SiWeather\Webservice\Location("", "");
|
|---|
| 45 |
|
|---|
| 46 | $value1 = "Wallhall";
|
|---|
| 47 | $value2 = "WH";
|
|---|
| 48 | $location->setRegion($value1, $value2);
|
|---|
| 49 | $this->assertEquals($location->regionName(), $value1);
|
|---|
| 50 | $this->assertEquals($location->regionCode(), $value2);
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | public function testCountry(){
|
|---|
| 54 | $location = new \SiWeather\Webservice\Location("", "");
|
|---|
| 55 |
|
|---|
| 56 | $value1 = "Wallhall";
|
|---|
| 57 | $value2 = "WH";
|
|---|
| 58 | $location->setCountry($value1, $value2);
|
|---|
| 59 | $this->assertEquals($location->countryName(), $value1);
|
|---|
| 60 | $this->assertEquals($location->countryCode(), $value2);
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | public function testLocation(){
|
|---|
| 64 | $location = new \SiWeather\Webservice\Location("", "");
|
|---|
| 65 |
|
|---|
| 66 | $latitude = -59.0;
|
|---|
| 67 | $longitude = 33;
|
|---|
| 68 | $location->setLocation($latitude, $longitude);
|
|---|
| 69 | $this->assertEquals($location->latitude(), $latitude);
|
|---|
| 70 | $this->assertEquals($location->longitude(), $longitude);
|
|---|
| 71 | $this->assertEquals($location->locationWKT(), $longitude ." ". $latitude);
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | public function testTimeZone(){
|
|---|
| 75 | $location = new \SiWeather\Webservice\Location("", "");
|
|---|
| 76 |
|
|---|
| 77 | $value = "Europe/Berlin";
|
|---|
| 78 | $location->setTimeZone($value);
|
|---|
| 79 | $this->assertEquals($location->timeZone(), $value);
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | public function constructor(){
|
|---|
| 83 | $city = "Nice Place";
|
|---|
| 84 | $zipCode = "0001";
|
|---|
| 85 | $regionName = "Nice Region";
|
|---|
| 86 | $regionCode = "NR";
|
|---|
| 87 | $countryName = "Nice Country";
|
|---|
| 88 | $countryCode = "NC";
|
|---|
| 89 | $longitude = 50;
|
|---|
| 90 | $latitude = 20;
|
|---|
| 91 | $location = new \SiWeather\Webservice\Location($city, $zipCode, $regionName,
|
|---|
| 92 | $regionCode, $countryName, $countryCode,
|
|---|
| 93 | $latitude, $longitude);
|
|---|
| 94 |
|
|---|
| 95 | $this->assertEquals($location->city(), $city);
|
|---|
| 96 | $this->assertEquals($location->zipCode(), $zipCode);
|
|---|
| 97 | $this->assertEquals($location->regionName(), $regionName);
|
|---|
| 98 | $this->assertEquals($location->regionCode(), $regionCode);
|
|---|
| 99 | $this->assertEquals($location->countryName(), $countryName);
|
|---|
| 100 | $this->assertEquals($location->countryCode(), $countryCode);
|
|---|
| 101 | $this->assertEquals($location->latitude(), $latitude);
|
|---|
| 102 | $this->assertEquals($location->longitude(), $longitude);
|
|---|
| 103 | $this->assertEquals($location->locationWkt(), $longitude ." ". $latitude);
|
|---|
| 104 | }
|
|---|
| 105 | }
|
|---|
| 106 | ?>
|
|---|