xref: /webtrees/tests/app/Http/RequestHandlers/ControlPanelControllerTest.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
10c0910bfSGreg Roach<?php
20c0910bfSGreg Roach
30c0910bfSGreg Roach/**
40c0910bfSGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
60c0910bfSGreg Roach * This program is free software: you can redistribute it and/or modify
70c0910bfSGreg Roach * it under the terms of the GNU General Public License as published by
80c0910bfSGreg Roach * the Free Software Foundation, either version 3 of the License, or
90c0910bfSGreg Roach * (at your option) any later version.
100c0910bfSGreg Roach * This program is distributed in the hope that it will be useful,
110c0910bfSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
120c0910bfSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130c0910bfSGreg Roach * GNU General Public License for more details.
140c0910bfSGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
160c0910bfSGreg Roach */
17fcfa147eSGreg Roach
180c0910bfSGreg Roachdeclare(strict_types=1);
190c0910bfSGreg Roach
20110d87e5SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
210c0910bfSGreg Roach
220c0910bfSGreg Roachuse Fig\Http\Message\StatusCodeInterface;
236fd01894SGreg Roachuse Fisharebest\Webtrees\Services\AdminService;
24a46dd5a6SGreg Roachuse Fisharebest\Webtrees\Services\EmailService;
252c685d76SGreg Roachuse Fisharebest\Webtrees\Services\GedcomImportService;
260c0910bfSGreg Roachuse Fisharebest\Webtrees\Services\HousekeepingService;
27a46dd5a6SGreg Roachuse Fisharebest\Webtrees\Services\MessageService;
280c0910bfSGreg Roachuse Fisharebest\Webtrees\Services\ModuleService;
290c0910bfSGreg Roachuse Fisharebest\Webtrees\Services\ServerCheckService;
300c0910bfSGreg Roachuse Fisharebest\Webtrees\Services\TimeoutService;
310c0910bfSGreg Roachuse Fisharebest\Webtrees\Services\TreeService;
320c0910bfSGreg Roachuse Fisharebest\Webtrees\Services\UpgradeService;
330c0910bfSGreg Roachuse Fisharebest\Webtrees\Services\UserService;
340c0910bfSGreg Roachuse Fisharebest\Webtrees\TestCase;
35*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
360c0910bfSGreg Roach
37*202c018bSGreg Roach#[CoversClass(ControlPanel::class)]
380c0910bfSGreg Roachclass ControlPanelControllerTest extends TestCase
390c0910bfSGreg Roach{
40cd94ca66SGreg Roach    protected static bool $uses_database = true;
410c0910bfSGreg Roach
420c0910bfSGreg Roach    public function testControlPanel(): void
430c0910bfSGreg Roach    {
446fd01894SGreg Roach        $admin_service         = new AdminService();
45a46dd5a6SGreg Roach        $message_service       = new MessageService(new EmailService(), new UserService());
460c0910bfSGreg Roach        $module_service        = new ModuleService();
470c0910bfSGreg Roach        $housekeeping_service  = new HousekeepingService();
480c0910bfSGreg Roach        $server_check_service  = new ServerCheckService();
490c0910bfSGreg Roach        $timeout_service       = new TimeoutService();
502c685d76SGreg Roach        $gedcom_import_service = new GedcomImportService();
512c685d76SGreg Roach        $tree_service          = new TreeService($gedcom_import_service);
520c0910bfSGreg Roach        $upgrade_service       = new UpgradeService($timeout_service);
530c0910bfSGreg Roach        $user_service          = new UserService();
54a46dd5a6SGreg Roach        $handler               = new ControlPanel($admin_service, $housekeeping_service, $message_service, $module_service, $server_check_service, $tree_service, $upgrade_service, $user_service);
550c0910bfSGreg Roach        $request               = self::createRequest();
560c0910bfSGreg Roach        $response              = $handler->handle($request);
570c0910bfSGreg Roach
585e933c21SGreg Roach        self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
590c0910bfSGreg Roach    }
600c0910bfSGreg Roach}
61