diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-01-13 08:47:07 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-01-13 08:53:40 +0000 |
| commit | e172383b8d1dc462218f743b1e04ca6a5babd14e (patch) | |
| tree | 64ae46c7c243c0a17e36c6437a229d2eea25a46e /tests | |
| parent | b43e8d2bb2c20432b6d427f0f5d9a32679a9aa4f (diff) | |
| download | webtrees-e172383b8d1dc462218f743b1e04ca6a5babd14e.tar.gz webtrees-e172383b8d1dc462218f743b1e04ca6a5babd14e.tar.bz2 webtrees-e172383b8d1dc462218f743b1e04ca6a5babd14e.zip | |
Refactor controller into request handlers
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/app/Http/RequestHandlers/MapProviderActionTest.php (renamed from tests/app/Http/Controllers/Admin/MapProviderControllerTest.php) | 28 | ||||
| -rw-r--r-- | tests/app/Http/RequestHandlers/MapProviderPageTest.php | 45 |
2 files changed, 53 insertions, 20 deletions
diff --git a/tests/app/Http/Controllers/Admin/MapProviderControllerTest.php b/tests/app/Http/RequestHandlers/MapProviderActionTest.php index ff2e44c80e..045fbcb604 100644 --- a/tests/app/Http/Controllers/Admin/MapProviderControllerTest.php +++ b/tests/app/Http/RequestHandlers/MapProviderActionTest.php @@ -17,41 +17,29 @@ declare(strict_types=1); -namespace Fisharebest\Webtrees\Http\Controllers\Admin; +namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\TestCase; /** - * Test the changes log controller + * Test the MapProviderAction request handler. * - * @covers \Fisharebest\Webtrees\Http\Controllers\Admin\MapProviderController + * @covers \Fisharebest\Webtrees\Http\RequestHandlers\MapProviderAction */ -class MapProviderControllerTest extends TestCase +class MapProviderActionTest extends TestCase { protected static $uses_database = true; /** * @return void */ - public function testMapProviderEdit(): void + public function testMapProviderAction(): void { - $controller = new MapProviderController(); - $request = self::createRequest(); - $response = $controller->mapProviderEdit($request); - - self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); - } - - /** - * @return void - */ - public function testMapProviderSave(): void - { - $controller = new MapProviderController(); - $request = self::createRequest(RequestMethodInterface::METHOD_POST, [], ['provider' => '', 'geonames' => '']); - $response = $controller->mapProviderSave($request); + $handler = new MapProviderAction(); + $request = self::createRequest(RequestMethodInterface::METHOD_POST, [], ['provider' => '', 'geonames' => '']); + $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_FOUND, $response->getStatusCode()); } diff --git a/tests/app/Http/RequestHandlers/MapProviderPageTest.php b/tests/app/Http/RequestHandlers/MapProviderPageTest.php new file mode 100644 index 0000000000..0ca2257046 --- /dev/null +++ b/tests/app/Http/RequestHandlers/MapProviderPageTest.php @@ -0,0 +1,45 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2020 webtrees development team + * 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/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Http\RequestHandlers; + +use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\TestCase; + +/** + * Test the MapProviderPage request handler. + * + * @covers \Fisharebest\Webtrees\Http\RequestHandlers\MapProviderPage + */ +class MapProviderPageTest extends TestCase +{ + protected static $uses_database = true; + + /** + * @return void + */ + public function testMapProviderPage(): void + { + $handler = new MapProviderPage(); + $request = self::createRequest(); + $response = $handler->handle($request); + + self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); + } +} |
