Changeset 1e37648 for src/webservice/tests/StationsTest.php
- Timestamp:
- Aug 28, 2015, 3:29:08 PM (11 years ago)
- Branches:
- master
- Children:
- b858e6f
- Parents:
- 851179e
- File:
-
- 1 edited
-
src/webservice/tests/StationsTest.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/webservice/tests/StationsTest.php
r851179e r1e37648 29 29 $this->assertNotNull($this->_testconfig); 30 30 31 require($testconfig["webserviceDirectory"] ."/inc/envsetup.php"); 31 32 require_once($testconfig["webserviceDirectory"] ."/SiWeather/Webservice/WebserviceConfig.php"); 32 33 … … 45 46 public function testStationRewrite() 46 47 { 47 $apiVersion = $this->_webserviceConfig->getConfig("webserviceApiVersion"); 48 $this->assertInternalType('string', $apiVersion); 49 $this->assertTrue(!empty($apiVersion)); 50 51 $stations = $this->query($apiVersion ."/stations"); 48 $stations = $this->query("stations"); 52 49 53 50 $this->assertInternalType("array", $stations); … … 56 53 57 54 protected function query($url){ 58 $baseUrl = $this->_webserviceConfig-> getConfig("webserviceBaseUrl");59 $this->assertInternalType('string', $baseUrl );60 $this->assertTrue(!empty($baseUrl) );55 $baseUrl = $this->_webserviceConfig->webserviceBaseUrl(); 56 $this->assertInternalType('string', $baseUrl, "baseUrl is not of type string: ". $baseUrl); 57 $this->assertTrue(!empty($baseUrl), "baseUrl is empty: ". $baseUrl); 61 58 $client = new GuzzleHttp\Client 62 59 ( … … 68 65 ); 69 66 $response = $client->get($url); 70 $this->assertNotNull($response );71 $this->assertEquals($response->getStatusCode(), 200 );72 $this->assertEquals($response->getReasonPhrase(), "OK" );67 $this->assertNotNull($response, "Response is empty. Url: ". $baseUrl . $url); 68 $this->assertEquals($response->getStatusCode(), 200, "Status code != 200. Url: ". $baseUrl . $url); 69 $this->assertEquals($response->getReasonPhrase(), "OK", "Reason phrase not empty. Url: ". $baseUrl . $url); 73 70 74 71 $body = $response->getBody(); 75 $this->assertTrue(!empty($body) );72 $this->assertTrue(!empty($body), "Response body is empty. Url: ". $baseUrl . $url); 76 73 $json = json_decode($body); 77 $this->assertNotNull($json );74 $this->assertNotNull($json, "Json decode returned null. Url: ". $baseUrl . $url ."\nBody: ". $body); 78 75 return $json; 79 76 }
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)