Ignore:
Timestamp:
Aug 28, 2015, 3:29:08 PM (11 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
master
Children:
b858e6f
Parents:
851179e
Message:
  • Rewrites are now working
    • Setup is now accessable via Slim too
    • Added 404 template to Slim app
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webservice/tests/StationsTest.php

    r851179e r1e37648  
    2929                $this->assertNotNull($this->_testconfig);
    3030               
     31                require($testconfig["webserviceDirectory"] ."/inc/envsetup.php");
    3132                require_once($testconfig["webserviceDirectory"] ."/SiWeather/Webservice/WebserviceConfig.php");
    3233               
    … …  
    4546        public function testStationRewrite()
    4647        {
    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");
    5249
    5350                $this->assertInternalType("array", $stations);
    … …  
    5653       
    5754        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);
    6158                $client = new GuzzleHttp\Client
    6259                (
    … …  
    6865                );
    6966                $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);
    7370
    7471                $body = $response->getBody();
    75                 $this->assertTrue(!empty($body));
     72                $this->assertTrue(!empty($body), "Response body is empty. Url: ". $baseUrl . $url);
    7673                $json = json_decode($body);
    77                 $this->assertNotNull($json);
     74                $this->assertNotNull($json, "Json decode returned null. Url: ". $baseUrl . $url ."\nBody: ". $body);
    7875                return $json;
    7976        }
Note: See TracChangeset for help on using the changeset viewer.