Files
Benjamin NussbaumandCursor f2ff4ad111 starter-kit-upgrade: Browser tests & Fortify skip guards
Upstream: laravel/livewire-starter-kit@0ca77fa
Adds skipUnlessFortifyHas on TestCase and Fortify-aware skips/assertions in auth tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 18:07:58 +02:00

30 lines
747 B
PHP

<?php
use Laravel\Fortify\Features;
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
beforeEach(function (): void {
$this->skipUnlessFortifyHas(Features::registration());
});
test('registration screen can be rendered', function (): void {
$response = $this->get(route('register'));
$response->assertOk();
});
test('new users can register', function (): void {
$response = $this->post(route('register.store'), [
'name' => 'John Doe',
'email' => 'test@example.com',
'password' => 'password',
'password_confirmation' => 'password',
]);
$response->assertSessionHasNoErrors()
->assertRedirect(route('dashboard', absolute: false));
$this->assertAuthenticated();
});