. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; /** * @covers \Fisharebest\Webtrees\Http\RequestHandlers\SelectLanguage */ class SelectLanguageTest extends TestCase { protected static bool $uses_database = true; public function testSelectLanguageForGuest(): void { $user = new GuestUser(); $handler = new SelectLanguage(); $request = self::createRequest() ->withAttribute('user', $user) ->withAttribute('language', 'fr'); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_NO_CONTENT, $response->getStatusCode()); } public function testSelectLanguageForUser(): void { $user_service = new UserService(); $user = $user_service->create('user', 'real', 'email', 'pass'); $handler = new SelectLanguage(); $request = self::createRequest() ->withAttribute('user', $user) ->withAttribute('language', 'fr'); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_NO_CONTENT, $response->getStatusCode()); } }