xref: /webtrees/tests/feature/IndividualListTest.php (revision d11be7027e34e3121be11cc025421873364403f9)
1e9e85398SGreg Roach<?php
23976b470SGreg Roach
3e9e85398SGreg Roach/**
4e9e85398SGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 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 Roach
26e9e85398SGreg Roach/**
27b9fc687eSGreg Roach * Test the individual lists.
28e9e85398SGreg Roach *
29e9e85398SGreg Roach * @coversNothing
30e9e85398SGreg Roach */
31e5a6b4d4SGreg Roachclass IndividualListTest extends TestCase
32e9e85398SGreg Roach{
33cd94ca66SGreg Roach    protected static bool $uses_database = true;
34e9e85398SGreg Roach
35e9e85398SGreg Roach    /**
365e933c21SGreg Roach     * @covers \Fisharebest\Webtrees\Module\IndividualListModule
37e9e85398SGreg Roach     * @return void
38e9e85398SGreg Roach     */
39b9fc687eSGreg Roach    public function testIndividualList(): void
40e9e85398SGreg Roach    {
41b9fc687eSGreg Roach        $tree        = $this->importTree('demo.ged');
424a9a6095SGreg Roach        $list_module = new IndividualListModule();
43b9fc687eSGreg Roach
44b3a775f6SGreg Roach        $request  = self::createRequest(RequestMethodInterface::METHOD_GET, [], [], [], ['tree' => $tree]);
4506a438b4SGreg Roach        $response = $list_module->handle($request);
465e933c21SGreg Roach        self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
47b9fc687eSGreg Roach
48b3a775f6SGreg Roach        $request  = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => 'B'], [], [], ['tree' => $tree]);
4906a438b4SGreg Roach        $response = $list_module->handle($request);
505e933c21SGreg Roach        self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
51b9fc687eSGreg Roach
52b3a775f6SGreg Roach        $request  = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => ','], [], [], ['tree' => $tree]);
5306a438b4SGreg Roach        $response = $list_module->handle($request);
545e933c21SGreg Roach        self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
55a67cd39fSGreg Roach
56b3a775f6SGreg Roach        $request  = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => '@'], [], [], ['tree' => $tree]);
5706a438b4SGreg Roach        $response = $list_module->handle($request);
585e933c21SGreg Roach        self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
59b9fc687eSGreg Roach
60b3a775f6SGreg Roach        $request  = self::createRequest(RequestMethodInterface::METHOD_GET, ['surname' => 'BRAUN'], [], [], ['tree' => $tree]);
6106a438b4SGreg Roach        $response = $list_module->handle($request);
625e933c21SGreg Roach        self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
63e9e85398SGreg Roach    }
64e9e85398SGreg Roach}
65