2024-07-18 00:11:32 -04:00
|
|
|
<?php
|
|
|
|
|
2025-01-30 00:23:55 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2024-07-18 00:11:32 -04:00
|
|
|
use Laravel\Fortify\Features;
|
|
|
|
use Laravel\Jetstream\Jetstream;
|
|
|
|
|
2025-01-30 00:23:55 -05:00
|
|
|
test('registration screen can be rendered', function (): void {
|
2024-07-18 00:11:32 -04:00
|
|
|
$response = $this->get('/register');
|
|
|
|
|
|
|
|
$response->assertStatus(200);
|
2025-01-30 00:23:55 -05:00
|
|
|
})->skip(fn (): bool => ! Features::enabled(Features::registration()), 'Registration support is not enabled.');
|
2024-07-18 00:11:32 -04:00
|
|
|
|
2025-01-30 00:23:55 -05:00
|
|
|
test('registration screen cannot be rendered if support is disabled', function (): void {
|
2024-07-18 00:11:32 -04:00
|
|
|
$response = $this->get('/register');
|
|
|
|
|
|
|
|
$response->assertStatus(404);
|
2025-01-30 00:23:55 -05:00
|
|
|
})->skip(fn () => Features::enabled(Features::registration()), 'Registration support is enabled.');
|
2024-07-18 00:11:32 -04:00
|
|
|
|
2025-01-30 00:23:55 -05:00
|
|
|
test('new users can register', function (): void {
|
2024-07-18 00:11:32 -04:00
|
|
|
$response = $this->post('/register', [
|
|
|
|
'name' => 'Test User',
|
|
|
|
'email' => 'test@example.com',
|
|
|
|
'password' => 'password',
|
|
|
|
'password_confirmation' => 'password',
|
|
|
|
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature(),
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->assertAuthenticated();
|
|
|
|
$response->assertRedirect(route('dashboard', absolute: false));
|
2025-01-30 00:23:55 -05:00
|
|
|
})->skip(fn (): bool => ! Features::enabled(Features::registration()), 'Registration support is not enabled.');
|