1e9e85398SGreg Roach<?php 23976b470SGreg Roach 3e9e85398SGreg Roach/** 4e9e85398SGreg Roach * webtrees: online genealogy 589f7189bSGreg Roach * Copyright (C) 2021 webtrees development team 6e9e85398SGreg Roach * This program is free software: you can redistribute it and/or modify 7e9e85398SGreg Roach * it under the terms of the GNU General Public License as published by 8e9e85398SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9e9e85398SGreg Roach * (at your option) any later version. 10e9e85398SGreg Roach * This program is distributed in the hope that it will be useful, 11e9e85398SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12e9e85398SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13e9e85398SGreg Roach * GNU General Public License for more details. 14e9e85398SGreg 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/>. 16e9e85398SGreg Roach */ 17fcfa147eSGreg Roach 18e9e85398SGreg Roachdeclare(strict_types=1); 19e9e85398SGreg Roach 20e9e85398SGreg Roachnamespace Fisharebest\Webtrees; 21e9e85398SGreg Roach 2271378461SGreg Roachuse Fig\Http\Message\RequestMethodInterface; 2371378461SGreg Roachuse Fig\Http\Message\StatusCodeInterface; 2487cca37cSGreg Roachuse Fisharebest\Webtrees\Module\IndividualListModule; 25b9fc687eSGreg Roachuse Fisharebest\Webtrees\Services\LocalizationService; 26b9fc687eSGreg Roach 27e9e85398SGreg Roach/** 28b9fc687eSGreg Roach * Test the individual lists. 29e9e85398SGreg Roach * 30e9e85398SGreg Roach * @coversNothing 31e9e85398SGreg Roach */ 32e5a6b4d4SGreg Roachclass IndividualListTest extends TestCase 33e9e85398SGreg Roach{ 34*cd94ca66SGreg Roach protected static bool $uses_database = true; 35e9e85398SGreg Roach 36e9e85398SGreg Roach /** 375e933c21SGreg Roach * @covers \Fisharebest\Webtrees\Module\IndividualListModule 38e9e85398SGreg Roach * @return void 39e9e85398SGreg Roach */ 40b9fc687eSGreg Roach public function testIndividualList(): void 41e9e85398SGreg Roach { 42b9fc687eSGreg Roach $tree = $this->importTree('demo.ged'); 4306a438b4SGreg Roach $list_module = new IndividualListModule(new LocalizationService()); 44b9fc687eSGreg Roach 45b3a775f6SGreg Roach $request = self::createRequest(RequestMethodInterface::METHOD_GET, [], [], [], ['tree' => $tree]); 4606a438b4SGreg Roach $response = $list_module->handle($request); 475e933c21SGreg Roach self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); 48b9fc687eSGreg Roach 49b3a775f6SGreg Roach $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => 'B'], [], [], ['tree' => $tree]); 5006a438b4SGreg Roach $response = $list_module->handle($request); 515e933c21SGreg Roach self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); 52b9fc687eSGreg Roach 53b3a775f6SGreg Roach $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => ','], [], [], ['tree' => $tree]); 5406a438b4SGreg Roach $response = $list_module->handle($request); 555e933c21SGreg Roach self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); 56a67cd39fSGreg Roach 57b3a775f6SGreg Roach $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => '@'], [], [], ['tree' => $tree]); 5806a438b4SGreg Roach $response = $list_module->handle($request); 595e933c21SGreg Roach self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); 60b9fc687eSGreg Roach 61b3a775f6SGreg Roach $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['surname' => 'BRAUN'], [], [], ['tree' => $tree]); 6206a438b4SGreg Roach $response = $list_module->handle($request); 635e933c21SGreg Roach self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); 64e9e85398SGreg Roach } 65e9e85398SGreg Roach} 66