summaryrefslogtreecommitdiff
path: root/tests/app
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-02-01 11:42:40 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-02-01 12:25:36 +0000
commit350ffb989b31cd28295dce731ed1037b8469fc53 (patch)
treed180ea76517096b3912e8d84ee5c94d53c4b070d /tests/app
parent94c9bb3d58b116d5008dfb3b40fd5da0683a68c6 (diff)
downloadwebtrees-350ffb989b31cd28295dce731ed1037b8469fc53.tar.gz
webtrees-350ffb989b31cd28295dce731ed1037b8469fc53.tar.bz2
webtrees-350ffb989b31cd28295dce731ed1037b8469fc53.zip
Refactor admin controller
Diffstat (limited to 'tests/app')
-rw-r--r--tests/app/Http/Controllers/Admin/FixLevel0MediaControllerTest.php69
-rw-r--r--tests/app/Http/Controllers/Admin/ImportThumbnailsControllerTest.php64
-rw-r--r--tests/app/Http/Controllers/Admin/MapProviderControllerTest.php52
3 files changed, 185 insertions, 0 deletions
diff --git a/tests/app/Http/Controllers/Admin/FixLevel0MediaControllerTest.php b/tests/app/Http/Controllers/Admin/FixLevel0MediaControllerTest.php
new file mode 100644
index 0000000000..8c10da3713
--- /dev/null
+++ b/tests/app/Http/Controllers/Admin/FixLevel0MediaControllerTest.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 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\Controllers\Admin;
+
+use Fisharebest\Webtrees\Tree;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+
+/**
+ * Test FixLevel0MediaControllerTest class.
+ *
+ * @covers \Fisharebest\Webtrees\Http\Controllers\Admin\FixLevel0MediaController
+ */
+class FixLevel0MediaControllerTest extends \Fisharebest\Webtrees\TestCase
+{
+ protected static $uses_database = true;
+
+ /**
+ * @return void
+ */
+ public function testFixLevel0Media(): void
+ {
+ $controller = app()->make(FixLevel0MediaController::class);
+ $response = app()->dispatch($controller, 'fixLevel0Media');
+
+ $this->assertInstanceOf(Response::class, $response);
+ }
+
+ /**
+ * @return void
+ */
+ public function testFixLevel0MediaAction(): void
+ {
+ $tree = Tree::create('name', 'title');
+ app()->instance(Request::class, new Request([], ['tree_id' => $tree->id()]));
+
+ $controller = app()->make(FixLevel0MediaController::class);
+ $response = app()->dispatch($controller, 'fixLevel0MediaAction');
+
+ $this->assertInstanceOf(Response::class, $response);
+ }
+
+ /**
+ * @return void
+ */
+ public function testFixLevel0MediaData(): void
+ {
+ // Can't test this yet - the query uses MySQL-specific functions
+ //$controller = app()->make(FixLevel0MediaController::class);
+ //$response = app()->dispatch($controller, 'fixLevel0MediaData');
+
+ //$this->assertInstanceOf(Response::class, $response);
+ }
+}
diff --git a/tests/app/Http/Controllers/Admin/ImportThumbnailsControllerTest.php b/tests/app/Http/Controllers/Admin/ImportThumbnailsControllerTest.php
new file mode 100644
index 0000000000..f955182e2f
--- /dev/null
+++ b/tests/app/Http/Controllers/Admin/ImportThumbnailsControllerTest.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 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\Controllers\Admin;
+
+use Symfony\Component\HttpFoundation\Response;
+
+/**
+ * Test ImportThumbnailsController class.
+ *
+ * @covers \Fisharebest\Webtrees\Http\Controllers\Admin\ImportThumbnailsController
+ */
+class ImportThumbnailsControllerTest extends \Fisharebest\Webtrees\TestCase
+{
+ protected static $uses_database = true;
+
+ /**
+ * @return void
+ */
+ public function testWebtrees1Thumbnails(): void
+ {
+ $controller = app()->make(ImportThumbnailsController::class);
+ $response = app()->dispatch($controller, 'webtrees1Thumbnails');
+
+ $this->assertInstanceOf(Response::class, $response);
+ }
+
+ /**
+ * @return void
+ */
+ public function testWebtrees1ThumbnailsAction(): void
+ {
+ $controller = app()->make(ImportThumbnailsController::class);
+ $response = app()->dispatch($controller, 'webtrees1ThumbnailsAction');
+
+ $this->assertInstanceOf(Response::class, $response);
+ }
+
+ /**
+ * @return void
+ */
+ public function testWebtrees1ThumbnailsData(): void
+ {
+ // Can't test this yet - the query uses MySQL-specific functions
+ //$controller = app()->make(ImportThumbnailsController::class);
+ //$response = app()->dispatch($controller, 'webtrees1ThumbnailsData');
+
+ //$this->assertInstanceOf(Response::class, $response);
+ }
+}
diff --git a/tests/app/Http/Controllers/Admin/MapProviderControllerTest.php b/tests/app/Http/Controllers/Admin/MapProviderControllerTest.php
new file mode 100644
index 0000000000..6dd24b6ac1
--- /dev/null
+++ b/tests/app/Http/Controllers/Admin/MapProviderControllerTest.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 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\Controllers\Admin;
+
+use Symfony\Component\HttpFoundation\Response;
+
+/**
+ * Test the changes log controller
+ *
+ * @covers \Fisharebest\Webtrees\Http\Controllers\Admin\MapProviderController
+ */
+class MapProviderControllerTest extends \Fisharebest\Webtrees\TestCase
+{
+ protected static $uses_database = true;
+
+ /**
+ * @return void
+ */
+ public function testMapProviderEdit(): void
+ {
+ $controller = app()->make(MapProviderController::class);
+ $response = app()->dispatch($controller, 'mapProviderEdit');
+
+ $this->assertInstanceOf(Response::class, $response);
+ }
+
+ /**
+ * @return void
+ */
+ public function testMapProviderSave(): void
+ {
+ $controller = app()->make(MapProviderController::class);
+ $response = app()->dispatch($controller, 'mapProviderSave');
+
+ $this->assertInstanceOf(Response::class, $response);
+ }
+}