- File:
-
- 1 edited
-
src/webapp/webservice/tests/ServiceTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/webapp/webservice/tests/ServiceTest.php
rc455d7b r26f77a6 20 20 // declare(Strict_types=1); 21 21 22 namespace GnuBoat; 23 22 24 /** 23 * @brief Covers index.php tests25 * @brief Covers Service.php tests 24 26 */ 25 final class ServiceTest extends PHPUnit_Framework_TestCase27 final class ServiceTest extends \PHPUnit_Framework_TestCase 26 28 { 27 /**28 * @runInSeparateProcess29 */30 29 public function testData() 31 30 { 32 $webservice = new GnuBoat\Webservice();33 $this->assertInstanceOf( GnuBoat\Webservice::class, $webservice);34 $_ POST["request"] = "data";31 $webservice = new Webservice(0); 32 $this->assertInstanceOf(Webservice::class, $webservice); 33 $_GET["request"] = "data"; 35 34 $webservice->process(); 36 35 } 37 36 38 /**39 * @runInSeparateProcess40 */41 37 public function testLogFiles() 42 38 { 43 $webservice = new GnuBoat\Webservice();44 $this->assertInstanceOf( GnuBoat\Webservice::class, $webservice);45 $_ POST["request"] = "logfiles";39 $webservice = new Webservice(0); 40 $this->assertInstanceOf(Webservice::class, $webservice); 41 $_GET["request"] = "logfiles"; 46 42 $webservice->process(); 47 43 } 48 44 49 /**50 * @runInSeparateProcess51 */52 45 public function testShutdown() 53 46 { 54 $webservice = new GnuBoat\Webservice();55 $this->assertInstanceOf( GnuBoat\Webservice::class, $webservice);56 $_ POST["request"] = "shutdown";47 $webservice = new Webservice(0); 48 $this->assertInstanceOf(Webservice::class, $webservice); 49 $_GET["request"] = "shutdown"; 57 50 $webservice->process(); 58 51 } 59 60 /** 61 * @runInSeparateProcess 62 */ 52 63 53 public function testMap() 64 54 { 65 $webservice = new GnuBoat\Webservice();66 $this->assertInstanceOf( GnuBoat\Webservice::class, $webservice);67 $_ POST["request"] = "map";55 $webservice = new Webservice(0); 56 $this->assertInstanceOf(Webservice::class, $webservice); 57 $_GET["request"] = "map"; 68 58 $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":1.001,"longitude":1.001,"speedthroughwater":"-","speedoverground":11,"courseoverground":21,"waterdepth":"-","watertemperature":"-","gpsfix":"-"},"1503767413":{"latitude":2.0186666666667001,"longitude":2.0186666666667001,"speedthroughwater":"-","speedoverground":12,"courseoverground":22,"waterdepth":"-","watertemperature":"-","gpsfix":"-"},"1503767414":{"latitude":3.1696666666666999,"longitude":3.1696666666666999,"speedthroughwater":"-","speedoverground":13,"courseoverground":23,"waterdepth":1,"watertemperature":21,"gpsfix":"-"},"1503767415":{"latitude":4.004,"longitude":4.004,"speedthroughwater":"-","speedoverground":14,"courseoverground":24,"waterdepth":2,"watertemperature":22,"gpsfix":"-"},"1503767416":{"latitude":5.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 72 77 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
