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