Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webservice/tests/ServiceTest.php

    ra50c18f rc455d7b  
    2020// declare(Strict_types=1);
    2121
    22 namespace GnuBoat;
    23 
    2422/**
    25   * @brief Covers Service.php tests
     23  * @brief Covers index.php tests
    2624  */
    27 final class ServiceTest extends \PHPUnit_Framework_TestCase
     25final class ServiceTest extends PHPUnit_Framework_TestCase
    2826{
     27        /**
     28          * @runInSeparateProcess
     29          */
    2930        public function testData()
    3031        {
    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";
    3435                $webservice->process();
    3536        }
    3637
     38        /**
     39          * @runInSeparateProcess
     40          */
    3741        public function testLogFiles()
    3842        {
    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";
    4246                $webservice->process();
    4347        }
    4448       
     49        /**
     50          * @runInSeparateProcess
     51          */
    4552        public function testShutdown()
    4653        {
    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";
    5057                $webservice->process();
    5158        }
    52 
     59       
     60        /**
     61          * @runInSeparateProcess
     62          */
    5363        public function testMap()
    5464        {
    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";
    5868                $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);
    6969        }
    7070}
    7171
    72 function error_log($msg)
    73 {
    74         echo "ERR GnuBoat: ". $msg ."\n";
    75 }
    76 
    7772?>
Note: See TracChangeset for help on using the changeset viewer.