Files
cv-roberto/tests/Feature/Controllers/ProfileControllerTest.php
Roberto 9df6c0ab46
All checks were successful
Tests / Laravel tests (pull_request) Successful in 3m31s
feat: include testing, factories, git workflow for testing.
2026-06-03 21:23:39 +02:00

20 lines
656 B
PHP

<?php
use App\Models\User;
test('guests cannot access profile management routes', function () {
$this->get(route('profile.edit'))->assertRedirect(route('login'));
$this->patch(route('profile.update'), [])->assertRedirect(route('login'));
$this->delete(route('profile.destroy'), [])->assertRedirect(route('login'));
});
test('the profile edit page receives the authenticated user', function () {
$user = User::factory()->create();
$this->actingAs($user)
->get(route('profile.edit'))
->assertOk()
->assertViewIs('profile.edit')
->assertViewHas('user', fn (User $viewUser) => $viewUser->is($user));
});