/
evo
/
docviz
Обзор
Документация
Войти
/
evo
/
docviz
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
tests/Feature/ProfileTest.php
66 строк
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 ProfileTest extends TestCase { use RefreshDatabase; public function test_profile_show_returns_200(): void { $user = User::factory()->user()->create(); $response = $this->get(route('profile.show', $user)); $response->assertStatus(200); } public function test_profile_edit_requires_auth(): void { $response = $this->get(route('profile.edit')); $response->assertRedirect(route('login')); } public function test_profile_edit_returns_200_when_authenticated(): void { $user = User::factory()->user()->create(); $response = $this->actingAs($user)->get(route('profile.edit')); $response->assertStatus(200); } public function test_profile_update_requires_auth(): void { $response = $this->put(route('profile.update'), [ 'name' => 'Updated', 'email' => 'updated@example.com', ]); $response->assertRedirect(route('login')); } public function test_user_can_update_profile(): void { $user = User::factory()->user()->create([ 'name' => 'Old Name', 'email' => 'old@example.com', ]); $response = $this->actingAs($user)->put(route('profile.update'), [ 'name' => 'New Name', 'email' => 'old@example.com', ]); $response->assertRedirect(route('profile.show', $user)); $response->assertSessionHas('success'); $user->refresh(); $this->assertSame('New Name', $user->name); } public function test_profile_alias_redirects_to_profile(): void { $user = User::factory()->user()->create(['alias' => 'johndoe']); $response = $this->get(route('profile.alias', 'johndoe')); $response->assertStatus(200); } }