Files
monica/tests/Feature/Auth/RegistrationTest.php
T
2024-04-07 22:37:54 +02:00

49 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature\Auth;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Laravel\Fortify\Features;
use Laravel\Jetstream\Jetstream;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class RegistrationTest extends TestCase
{
use DatabaseTransactions;
#[Test]
public function registration_screen_can_be_rendered()
{
$this->withoutVite();
if (! Features::enabled(Features::registration())) {
return $this->markTestSkipped('Registration support is not enabled.');
}
$response = $this->get('/register');
$response->assertStatus(200);
}
#[Test]
public function new_users_can_register()
{
if (! Features::enabled(Features::registration())) {
return $this->markTestSkipped('Registration support is not enabled.');
}
$response = $this->post('/register', [
'first_name' => 'Test',
'last_name' => 'User',
'email' => 'test@example.com',
'password' => 'Password$123',
'password_confirmation' => 'Password$123',
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature(),
]);
$this->assertAuthenticated();
$response->assertRedirect('/vaults');
}
}