<?php
/*
    Copyright (C) 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

namespace gnuboat_mapservice\Test\V1\Rest;

//  enable in php 7
// declare(Strict_types=1);
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
use Zend\Stdlib\ArrayUtils;
use Zend\Http\Request;
use Zend\Http\Headers;

// use ApplicationTest\Bootstrap;
use Zend\Mvc\Router\Http\TreeRouteStack as HttpRouter;
use Application\Controller\IndexController;
use Zend\Http\Request;
use Zend\Http\Response;
use Zend\Mvc\MvcEvent;
use Zend\Mvc\Router\RouteMatch;
use PHPUnit_Framework_TestCase;

/**
* @brief Covers Parser.php
*/
final class WatersTest extends AbstractHttpControllerTestCase
{
	protected $traceError = true;
	
	protected $controller;
    protected $request;
    protected $response;
    protected $routeMatch;
    protected $event;

	public function setUp()
    {
// 		$configOverrides = [
// 			'module_listener_options' => [
// 				'config_cache_enabled' => false,
// 			],
// 		];
// 
// 		$this->setApplicationConfig(ArrayUtils::merge(
// 			include __DIR__ . '/../../../../../config/application.config.php',
// 			$configOverrides
// 		));
// 
// 		parent::setUp();

// 		$serviceManager = Bootstrap::getServiceManager();
        $this->controller = new IndexController();
        $this->request    = new Request();
        $this->routeMatch = new RouteMatch(array('controller' => 'index'));
        $this->event      = new MvcEvent();
        $config = $serviceManager->get('Config');
        $routerConfig = isset($config['router']) ? $config['router'] : array();
        $router = HttpRouter::factory($routerConfig);

        $this->event->setRouter($router);
        $this->event->setRouteMatch($this->routeMatch);
        $this->controller->setEvent($this->event);
        $this->controller->setServiceLocator($serviceManager);
	}

    public function testWatersById()
    {
// 		$this->request = new \Zend\Http\Request();
// 		$headers = new \Zend\Http\Headers;
// 		$headers->addHeaderLine('Accept', 'application/json');
// // 		$this->request->setHeaders($headers);
//         $this->dispatch('/waters/1');
//         $this->assertResponseStatusCode(200);
// 
//         $this->assertModuleName('application');
//         $this->assertControllerName('application_index');
//         $this->assertControllerClass('IndexController');
//         $this->assertMatchedRouteName('home');
    }
}

?>
