| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | Copyright (C) 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 4 |
|
|---|
| 5 | This program is free software: you can redistribute it and/or modify
|
|---|
| 6 | it under the terms of the GNU General Public License as published by
|
|---|
| 7 | the Free Software Foundation, either version 3 of the License, or
|
|---|
| 8 | (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This program is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | GNU General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU General Public License
|
|---|
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | namespace gnuboat_mapservice\Test\V1\Rest;
|
|---|
| 20 |
|
|---|
| 21 | // enable in php 7
|
|---|
| 22 | // declare(Strict_types=1);
|
|---|
| 23 | use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
|
|---|
| 24 | use Zend\Stdlib\ArrayUtils;
|
|---|
| 25 | use Zend\Http\Request;
|
|---|
| 26 | use Zend\Http\Headers;
|
|---|
| 27 |
|
|---|
| 28 | // use ApplicationTest\Bootstrap;
|
|---|
| 29 | use Zend\Mvc\Router\Http\TreeRouteStack as HttpRouter;
|
|---|
| 30 | use Application\Controller\IndexController;
|
|---|
| 31 | use Zend\Http\Request;
|
|---|
| 32 | use Zend\Http\Response;
|
|---|
| 33 | use Zend\Mvc\MvcEvent;
|
|---|
| 34 | use Zend\Mvc\Router\RouteMatch;
|
|---|
| 35 | use PHPUnit_Framework_TestCase;
|
|---|
| 36 |
|
|---|
| 37 | /**
|
|---|
| 38 | * @brief Covers Parser.php
|
|---|
| 39 | */
|
|---|
| 40 | final class WatersTest extends AbstractHttpControllerTestCase
|
|---|
| 41 | {
|
|---|
| 42 | protected $traceError = true;
|
|---|
| 43 |
|
|---|
| 44 | protected $controller;
|
|---|
| 45 | protected $request;
|
|---|
| 46 | protected $response;
|
|---|
| 47 | protected $routeMatch;
|
|---|
| 48 | protected $event;
|
|---|
| 49 |
|
|---|
| 50 | public function setUp()
|
|---|
| 51 | {
|
|---|
| 52 | // $configOverrides = [
|
|---|
| 53 | // 'module_listener_options' => [
|
|---|
| 54 | // 'config_cache_enabled' => false,
|
|---|
| 55 | // ],
|
|---|
| 56 | // ];
|
|---|
| 57 | //
|
|---|
| 58 | // $this->setApplicationConfig(ArrayUtils::merge(
|
|---|
| 59 | // include __DIR__ . '/../../../../../config/application.config.php',
|
|---|
| 60 | // $configOverrides
|
|---|
| 61 | // ));
|
|---|
| 62 | //
|
|---|
| 63 | // parent::setUp();
|
|---|
| 64 |
|
|---|
| 65 | // $serviceManager = Bootstrap::getServiceManager();
|
|---|
| 66 | $this->controller = new IndexController();
|
|---|
| 67 | $this->request = new Request();
|
|---|
| 68 | $this->routeMatch = new RouteMatch(array('controller' => 'index'));
|
|---|
| 69 | $this->event = new MvcEvent();
|
|---|
| 70 | $config = $serviceManager->get('Config');
|
|---|
| 71 | $routerConfig = isset($config['router']) ? $config['router'] : array();
|
|---|
| 72 | $router = HttpRouter::factory($routerConfig);
|
|---|
| 73 |
|
|---|
| 74 | $this->event->setRouter($router);
|
|---|
| 75 | $this->event->setRouteMatch($this->routeMatch);
|
|---|
| 76 | $this->controller->setEvent($this->event);
|
|---|
| 77 | $this->controller->setServiceLocator($serviceManager);
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | public function testWatersById()
|
|---|
| 81 | {
|
|---|
| 82 | // $this->request = new \Zend\Http\Request();
|
|---|
| 83 | // $headers = new \Zend\Http\Headers;
|
|---|
| 84 | // $headers->addHeaderLine('Accept', 'application/json');
|
|---|
| 85 | // // $this->request->setHeaders($headers);
|
|---|
| 86 | // $this->dispatch('/waters/1');
|
|---|
| 87 | // $this->assertResponseStatusCode(200);
|
|---|
| 88 | //
|
|---|
| 89 | // $this->assertModuleName('application');
|
|---|
| 90 | // $this->assertControllerName('application_index');
|
|---|
| 91 | // $this->assertControllerClass('IndexController');
|
|---|
| 92 | // $this->assertMatchedRouteName('home');
|
|---|
| 93 | }
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | ?>
|
|---|