/
evo
/
docviz
Обзор
Документация
Войти
/
evo
/
docviz
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
tests/Feature/DashboardTest.php
53 строки
2 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 DashboardTest extends TestCase { use RefreshDatabase; public function test_dashboard_requires_auth(): void { $response = $this->get(route('dashboard.home')); $response->assertRedirect(route('login')); } public function test_dashboard_requires_role(): void { $user = User::factory()->user()->create(); $response = $this->actingAs($user)->get(route('dashboard.home')); $response->assertStatus(403); } public function test_editor_can_access_dashboard(): void { $user = User::factory()->editor()->create(); $response = $this->actingAs($user)->get(route('dashboard.home')); $response->assertStatus(200); } public function test_admin_can_access_dashboard(): void { $user = User::factory()->admin()->create(); $response = $this->actingAs($user)->get(route('dashboard.home')); $response->assertStatus(200); } public function test_health_check_requires_auth(): void { $response = $this->getJson(route('dashboard.health')); $response->assertStatus(401); } public function test_health_check_returns_json_when_authenticated(): void { $user = User::factory()->admin()->create(); $response = $this->actingAs($user)->getJson(route('dashboard.health')); $response->assertStatus(200); $response->assertJsonStructure(['checks' => []]); } }