Changeset 519df6e for src/webservice/tests
- Timestamp:
- Aug 30, 2015, 8:58:06 PM (11 years ago)
- Branches:
- master
- Children:
- a0f5395
- Parents:
- d5d4498
- File:
-
- 1 edited
-
src/webservice/tests/StationsTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/webservice/tests/StationsTest.php
rd5d4498 r519df6e 65 65 ] 66 66 ); 67 68 // sending must failing register request, caused by unproven location 67 69 $response = $client->post("index.php/stations/register", 68 [ "json" => ["name" => "Cool Station", "longitude" => 23.2, "latitude" => 90, "city" => " Krefeld"]]70 [ "json" => ["name" => "Cool Station", "longitude" => 23.2, "latitude" => 90, "city" => "Nice town"]] 69 71 ); 70 echo $response->getStatusCode(); 71 echo $response->getBody(); 72 $this->assertEquals($response->getStatusCode(), 200, $response->getReasonPhrase()); 73 $json = json_decode($response->getBody(), true); 74 $this->assertTrue(array_key_exists("result", $json)); 75 $this->assertTrue(array_key_exists("message", $json)); 76 $this->assertEquals("unprovenlocation", $json["result"]); 77 78 // try again with set "locationchecked" to true 79 $response = $client->post("index.php/stations/register", 80 [ "json" => ["name" => "Cool Station", "longitude" => 23.2, 81 "latitude" => 90, "city" => "Nice town", "locationchecked" => true]] 82 ); 83 $this->assertEquals($response->getStatusCode(), 200, $response->getReasonPhrase()); 84 $json = json_decode($response->getBody(), true); 85 $this->assertTrue(array_key_exists("result", $json)); 86 $this->assertTrue(array_key_exists("uuid", $json)); 87 $this->assertEquals("success", $json["result"]); 88 $this->assertTrue(!empty($json["uuid"])); 89 72 90 } 73 91 … … 91 109 $body = $response->getBody(); 92 110 $this->assertTrue(!empty($body), "Response body is empty. Url: ". $baseUrl . $url); 93 $json = json_decode($body );111 $json = json_decode($body, true); 94 112 $this->assertNotNull($json, "Json decode returned null. Url: ". $baseUrl . $url ."\nBody: ". $body); 95 113 return $json;
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)