. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Services\GedcomImportService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; /** * @covers \Fisharebest\Webtrees\Http\RequestHandlers\LoginPage */ class LoginPageTest extends TestCase { /** * @return void */ public function testLoginPage(): void { $gedcom_import_service = new GedcomImportService(); $tree_service = new TreeService($gedcom_import_service); $request = self::createRequest(); $handler = new LoginPage($tree_service); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); } /** * @return void */ public function testLoginPageAlreadyLoggedIn(): void { $gedcom_import_service = new GedcomImportService(); $tree_service = new TreeService($gedcom_import_service); $user = $this->createMock(User::class); $request = self::createRequest()->withAttribute('user', $user); $handler = new LoginPage($tree_service); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_FOUND, $response->getStatusCode()); } }