Changeset d55ec21 for src/webservice/tests/StationsTest.php
- Timestamp:
- Sep 1, 2015, 4:45:03 PM (11 years ago)
- Branches:
- master
- Children:
- 256102b
- Parents:
- 02fbeb8
- File:
-
- 1 edited
-
src/webservice/tests/StationsTest.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/webservice/tests/StationsTest.php
r02fbeb8 rd55ec21 19 19 */ 20 20 21 /** 22 * @todo Reset database before this test is run 23 */ 21 require_once(__DIR__ ."/TestHelpers/TestSetup.php"); 22 24 23 class StationsTest extends PHPUnit_Framework_TestCase 25 24 { … … 37 36 $this->_webserviceConfig = new SiWeather\Webservice\WebserviceConfig(); 38 37 $this->assertNotNull($this->_webserviceConfig); 38 39 $this->_dataDirectory = $this->_webserviceConfig->getConfig("dataDirectory"); 40 $this->assertInternaltype("string", $this->_dataDirectory); 41 $this->assertTrue(!empty($this->_dataDirectory)); 42 if(file_exists($this->_dataDirectory)) 43 $this->assertTrue(TestHelpers\TestSetup::wipeDataDirectory()); 44 $this->assertTrue(TestHelpers\TestSetup::databaseSetup()); 45 } 46 47 protected function tearDown(){ 48 if(file_exists($this->_dataDirectory)) 49 $this->assertTrue(TestHelpers\TestSetup::wipeDataDirectory()); 39 50 } 40 51 … … 44 55 45 56 $this->assertInternalType("array", $stations); 57 $message = ""; 58 if(array_key_exists("message", $stations)) 59 $message = $stations["message"]; 60 $this->assertTrue(!array_key_exists("result", $stations), $message); 46 61 $this->assertEquals(count($stations), 0); 47 62 } 48 49 public function testStationRewrite()50 {51 $stations = $this->query("stations");52 63 53 $this->assertInternalType("array", $stations);54 $this->assertEquals(count($stations), 0);55 }56 57 64 public function testRegisterStationUnprovenLocation() 58 65 { 59 $baseUrl = $this->_webserviceConfig->webserviceBaseUrl();66 $baseUrl = TestHelpers\TestSetup::webserviceTestBaseUrl(); 60 67 $this->assertInternalType('string', $baseUrl, "baseUrl is not of type string: ". $baseUrl); 61 68 $this->assertTrue(!empty($baseUrl), "baseUrl is empty: ". $baseUrl); … … 82 89 public function testRegisterStation() 83 90 { 84 $baseUrl = $this->_webserviceConfig->webserviceBaseUrl();91 $baseUrl = TestHelpers\TestSetup::webserviceTestBaseUrl(); 85 92 $this->assertInternalType('string', $baseUrl, "baseUrl is not of type string: ". $baseUrl); 86 93 $this->assertTrue(!empty($baseUrl), "baseUrl is empty: ". $baseUrl); … … 94 101 ); 95 102 96 // sending must failing register request, caused by unproven location97 103 $response = $client->post("index.php/stations/register", 98 104 [ "json" => ["name" => "My Weather Station", "city" => "Clausthal-Zellerfeld", "longitude" => 10.28152, "latitude" => 51.8281, "email" => "test@example.org"]] … … 113 119 114 120 protected function query($url){ 115 $baseUrl = $this->_webserviceConfig->webserviceBaseUrl();121 $baseUrl = TestHelpers\TestSetup::webserviceTestBaseUrl(); 116 122 $this->assertInternalType('string', $baseUrl, "baseUrl is not of type string: ". $baseUrl); 117 123 $this->assertTrue(!empty($baseUrl), "baseUrl is empty: ". $baseUrl); … … 138 144 protected $_testconfig; 139 145 protected $_webserviceConfig; 146 protected $_dataDirectory; 140 147 } 141 148 ?>
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)