. */ declare(strict_types=1); namespace Fisharebest\Webtrees; use Fisharebest\Localization\Locale\LocaleEnUs; use Fisharebest\Webtrees\Http\Controllers\ListController; use Fisharebest\Webtrees\Module\ModuleThemeInterface; use Fisharebest\Webtrees\Module\WebtreesTheme; use Fisharebest\Webtrees\Services\IndividualListService; use Fisharebest\Webtrees\Services\LocalizationService; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; /** * Test the individual lists. * * @coversNothing */ class IndividualListTest extends \Fisharebest\Webtrees\TestCase { protected static $uses_database = true; /** * @covers \Fisharebest\Webtrees\Http\Controllers\ListController * @return void */ public function testIndividualList(): void { // Needed for Date::display() global $tree; $tree = $this->importTree('demo.ged'); $user = Auth::user(); app()->instance(Tree::class, $tree); app()->instance(User::class, $user); $localization_service = new LocalizationService(new LocaleEnUs()); $individual_list_service = new IndividualListService($localization_service, $tree); $controller = new ListController($individual_list_service, $localization_service); $request = new Request(['route' => 'individual-list']); $response = $controller->individualList($request, $tree, $user); $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); $request = new Request(['route' => 'individual-list', 'alpha' => 'B']); $response = $controller->individualList($request, $tree, $user); $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); $request = new Request(['route' => 'individual-list', 'alpha' => ',']); $response = $controller->individualList($request, $tree, $user); $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); $request = new Request(['route' => 'individual-list', 'alpha' => '@']); $response = $controller->individualList($request, $tree, $user); $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); $request = new Request(['route' => 'individual-list', 'surname' => 'BRAUN']); $response = $controller->individualList($request, $tree, $user); $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); } }