38 lines
1010 B
PHP
38 lines
1010 B
PHP
<?php
|
||
|
||
namespace Tests\Feature;
|
||
|
||
use Tests\TestCase;
|
||
|
||
class LocaleSwitchingTest extends TestCase
|
||
{
|
||
public function test_site_uses_russian_by_default(): void
|
||
{
|
||
$response = $this->get('/about');
|
||
|
||
$response->assertOk();
|
||
$response->assertSee('lang="ru"', false);
|
||
$response->assertSee('pc-lang-switcher-label">Рус<', false);
|
||
}
|
||
|
||
public function test_user_can_switch_site_locale_to_kazakh(): void
|
||
{
|
||
$response = $this->from('/about')->post('/locale/kk');
|
||
|
||
$response->assertRedirect('/about');
|
||
$response->assertSessionHas('locale', 'kk');
|
||
|
||
$this->withSession(['locale' => 'kk'])
|
||
->get('/about')
|
||
->assertOk()
|
||
->assertSee('lang="kk"', false)
|
||
->assertSee('pc-lang-switcher-label">Қаз<', false)
|
||
->assertSee('Басты бет');
|
||
}
|
||
|
||
public function test_unsupported_locale_returns_not_found(): void
|
||
{
|
||
$this->post('/locale/en')->assertNotFound();
|
||
}
|
||
}
|