. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; 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 $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()); } }