/
evo
/
docviz
Обзор
Документация
Войти
/
evo
/
docviz
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
tests/Feature/ThemeTest.php
41 строка
1 KB
evo
UI updates, deployment prep, and code highlighting fix
08 фев 2026, 12:17
Верифицирован
08 фев 2026, 12:17
2c0897e
Код
Авторство
О чём код?
<?php namespace Tests\Feature; use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; class ThemeTest extends TestCase { use RefreshDatabase; public function test_theme_update_requires_auth(): void { $response = $this->postJson(route('theme.update'), ['theme' => 'dark']); $response->assertStatus(401); } public function test_user_can_update_theme(): void { $user = User::factory()->user()->create(); $response = $this->actingAs($user)->postJson(route('theme.update'), [ 'theme' => 'dark', ]); $response->assertStatus(200); $response->assertJson(['ok' => true, 'theme' => 'dark']); $user->refresh(); $this->assertSame('dark', $user->theme); } public function test_theme_update_rejects_invalid_value(): void { $user = User::factory()->user()->create(); $response = $this->actingAs($user)->postJson(route('theme.update'), [ 'theme' => 'invalid', ]); $response->assertStatus(422); } }