. */ declare(strict_types=1); namespace Fisharebest\Webtrees; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Http\Controllers\ListController; use Fisharebest\Webtrees\Module\IndividualListModule; use Fisharebest\Webtrees\Services\IndividualListService; use Fisharebest\Webtrees\Services\LocalizationService; use Psr\Http\Message\ServerRequestInterface; /** * Test the individual lists. * * @coversNothing */ class IndividualListTest extends TestCase { protected static $uses_database = true; /** * @covers \Fisharebest\Webtrees\Http\Controllers\ListController * @return void */ public function testIndividualList(): void { $tree = $this->importTree('demo.ged'); $list_module = new IndividualListModule(); $localization_service = new LocalizationService(); $individual_list_service = new IndividualListService($localization_service, $tree); $controller = new ListController($individual_list_service, $localization_service); $request = self::createRequest(RequestMethodInterface::METHOD_GET, [], [], [], ['tree' => $tree]); $response = $controller->individualList($request, $list_module); $this->assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => 'B'], [], [], ['tree' => $tree]); $response = $controller->individualList($request, $list_module); $this->assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => ','], [], [], ['tree' => $tree]); $response = $controller->individualList($request, $list_module); $this->assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['alpha' => '@'], [], [], ['tree' => $tree]); $response = $controller->individualList($request, $list_module); $this->assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['surname' => 'BRAUN'], [], [], ['tree' => $tree]); $response = $controller->individualList($request, $list_module); $this->assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); } }