- File:
-
- 1 edited
-
src/webapp/webservice/tests/ServiceTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/webapp/webservice/tests/ServiceTest.php
ra50c18f rc455d7b 20 20 // declare(Strict_types=1); 21 21 22 namespace GnuBoat;23 24 22 /** 25 * @brief Covers Service.php tests23 * @brief Covers index.php tests 26 24 */ 27 final class ServiceTest extends \PHPUnit_Framework_TestCase25 final class ServiceTest extends PHPUnit_Framework_TestCase 28 26 { 27 /** 28 * @runInSeparateProcess 29 */ 29 30 public function testData() 30 31 { 31 $webservice = new Webservice(0);32 $this->assertInstanceOf( Webservice::class, $webservice);33 $_ GET["request"] = "data";32 $webservice = new GnuBoat\Webservice(); 33 $this->assertInstanceOf(GnuBoat\Webservice::class, $webservice); 34 $_POST["request"] = "data"; 34 35 $webservice->process(); 35 36 } 36 37 38 /** 39 * @runInSeparateProcess 40 */ 37 41 public function testLogFiles() 38 42 { 39 $webservice = new Webservice(0);40 $this->assertInstanceOf( Webservice::class, $webservice);41 $_ GET["request"] = "logfiles";43 $webservice = new GnuBoat\Webservice(); 44 $this->assertInstanceOf(GnuBoat\Webservice::class, $webservice); 45 $_POST["request"] = "logfiles"; 42 46 $webservice->process(); 43 47 } 44 48 49 /** 50 * @runInSeparateProcess 51 */ 45 52 public function testShutdown() 46 53 { 47 $webservice = new Webservice(0);48 $this->assertInstanceOf( Webservice::class, $webservice);49 $_ GET["request"] = "shutdown";54 $webservice = new GnuBoat\Webservice(); 55 $this->assertInstanceOf(GnuBoat\Webservice::class, $webservice); 56 $_POST["request"] = "shutdown"; 50 57 $webservice->process(); 51 58 } 52 59 60 /** 61 * @runInSeparateProcess 62 */ 53 63 public function testMap() 54 64 { 55 $webservice = new Webservice(0);56 $this->assertInstanceOf( Webservice::class, $webservice);57 $_ GET["request"] = "map";65 $webservice = new GnuBoat\Webservice(); 66 $this->assertInstanceOf(GnuBoat\Webservice::class, $webservice); 67 $_POST["request"] = "map"; 58 68 $webservice->process(); 59 }60 61 public function testReplay()62 {63 $webservice = new Webservice(0);64 $_GET["request"] = "replay";65 $_POST["logfile"] = "replay-test.log";66 $webservice->process();67 $output = $this->getActualOutput();68 $this->assertJsonStringEqualsJsonString('{"track":{"1503767412":{"latitude":10.001,"longitude":1.001,"speedthroughwater":"-","speedoverground":11,"courseoverground":21,"waterdepth":"-","watertemperature":"-","gpsfix":"-"},"1503767413":{"latitude":20.002,"longitude":2.002,"speedthroughwater":"-","speedoverground":12,"courseoverground":22,"waterdepth":"-","watertemperature":"-","gpsfix":"-"},"1503767414":{"latitude":30.003,"longitude":3.003,"speedthroughwater":"-","speedoverground":13,"courseoverground":23,"waterdepth":1,"watertemperature":21,"gpsfix":"-"},"1503767415":{"latitude":40.004,"longitude":4.004,"speedthroughwater":"-","speedoverground":14,"courseoverground":24,"waterdepth":2,"watertemperature":22,"gpsfix":"-"},"1503767416":{"latitude":50.005,"longitude":5.005,"speedthroughwater":"-","speedoverground":15,"courseoverground":25,"waterdepth":3,"watertemperature":23,"gpsfix":"-"}}}', $output);69 69 } 70 70 } 71 71 72 function error_log($msg)73 {74 echo "ERR GnuBoat: ". $msg ."\n";75 }76 77 72 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
