Changeset b5ebb8d for src/webservice/tests
- Timestamp:
- Aug 31, 2015, 11:02:06 PM (11 years ago)
- Branches:
- master
- Children:
- 69c8290
- Parents:
- a0f5395
- File:
-
- 1 edited
-
src/webservice/tests/LocationTest.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/webservice/tests/LocationTest.php
ra0f5395 rb5ebb8d 33 33 } 34 34 35 public function test ZipCode(){35 public function testPostalCode(){ 36 36 $location = new \SiWeather\Webservice\Location("", ""); 37 37 38 38 $value = "12345"; 39 $location->set ZipCode($value);40 $this->assertEquals($location-> zipCode(), $value);39 $location->setPostalCode($value); 40 $this->assertEquals($location->postalCode(), $value); 41 41 } 42 42 … … 59 59 $this->assertEquals($location->countryName(), $value1); 60 60 $this->assertEquals($location->countryCode(), $value2); 61 } 62 63 public function testValidLatitude_data(){ 64 $result = array(); 65 $result[] = array(null, false); 66 $result[] = array("asdasd", false); 67 $result[] = array(0, true); 68 $result[] = array(-90, true); 69 $result[] = array(90, true); 70 $result[] = array(85.1234, true); 71 $result[] = array(-90.0001, false); 72 $result[] = array(90.0001, false); 73 return $result; 74 } 75 76 /** 77 * @dataProvider testValidLatitude_data 78 */ 79 public function testValidLatitude($latitude, $result){ 80 $this->assertEquals(\SiWeather\Webservice\Location::validLatitude($latitude), $result); 81 } 82 83 public function testValidLongitude_data(){ 84 $result = array(); 85 $result[] = array(null, false); 86 $result[] = array("asdasd", false); 87 $result[] = array(0, true); 88 $result[] = array(-90, true); 89 $result[] = array(90, true); 90 $result[] = array(85.1234, true); 91 $result[] = array(-180.0001, false); 92 $result[] = array(180.0001, false); 93 return $result; 94 } 95 96 /** 97 * @dataProvider testValidLongitude_data 98 */ 99 public function testValidLongitude($longitude, $result){ 100 $this->assertEquals(\SiWeather\Webservice\Location::validLongitude($longitude), $result); 61 101 } 62 102 … … 82 122 public function constructor(){ 83 123 $city = "Nice Place"; 84 $ zipCode = "0001";124 $postalCode = "0001"; 85 125 $regionName = "Nice Region"; 86 126 $regionCode = "NR"; … … 89 129 $longitude = 50; 90 130 $latitude = 20; 91 $location = new \SiWeather\Webservice\Location($city, $ zipCode, $regionName,131 $location = new \SiWeather\Webservice\Location($city, $postalCode, $regionName, 92 132 $regionCode, $countryName, $countryCode, 93 133 $latitude, $longitude); 94 134 95 135 $this->assertEquals($location->city(), $city); 96 $this->assertEquals($location-> zipCode(), $zipCode);136 $this->assertEquals($location->postalCode(), $postalCode); 97 137 $this->assertEquals($location->regionName(), $regionName); 98 138 $this->assertEquals($location->regionCode(), $regionCode);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/siweather/chrome/site/your_project_logo.png)