Save workspace changes
This commit is contained in:
@@ -8,13 +8,8 @@ use Illuminate\Support\Facades\Queue;
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('shows registration notice with email after first step', function () {
|
||||
Queue::fake();
|
||||
|
||||
$this->post('/register', [
|
||||
'email' => 'notice@example.com',
|
||||
])->assertRedirect('/register/notice');
|
||||
|
||||
$this->get('/register/notice')
|
||||
$this->withSession(['registration_email' => 'notice@example.com'])
|
||||
->get('/register/notice')
|
||||
->assertOk()
|
||||
->assertSee('notice@example.com')
|
||||
->assertSee('Change email');
|
||||
@@ -29,9 +24,12 @@ it('prefills register form email from query string', function () {
|
||||
it('blocks resend while cooldown is active', function () {
|
||||
Queue::fake();
|
||||
|
||||
$this->post('/register', [
|
||||
User::factory()->create([
|
||||
'email' => 'cooldown@example.com',
|
||||
])->assertRedirect('/register/notice');
|
||||
'email_verified_at' => null,
|
||||
'onboarding_step' => 'email',
|
||||
'last_verification_sent_at' => now(),
|
||||
]);
|
||||
|
||||
$response = $this->from('/register/notice')->post('/register/resend-verification', [
|
||||
'email' => 'cooldown@example.com',
|
||||
@@ -41,26 +39,24 @@ it('blocks resend while cooldown is active', function () {
|
||||
$response->assertSessionHasNoErrors();
|
||||
$response->assertSessionHas('status', 'If that email is valid, we sent a verification link.');
|
||||
|
||||
Queue::assertPushed(SendVerificationEmailJob::class, 1);
|
||||
Queue::assertNothingPushed();
|
||||
});
|
||||
|
||||
it('resends verification after cooldown expires', function () {
|
||||
Queue::fake();
|
||||
|
||||
$this->post('/register', [
|
||||
User::factory()->create([
|
||||
'email' => 'resend@example.com',
|
||||
])->assertRedirect('/register/notice');
|
||||
|
||||
$user = User::query()->where('email', 'resend@example.com')->firstOrFail();
|
||||
$user->forceFill([
|
||||
'email_verified_at' => null,
|
||||
'onboarding_step' => 'email',
|
||||
'last_verification_sent_at' => now()->subMinutes(31),
|
||||
])->save();
|
||||
]);
|
||||
|
||||
$this->post('/register/resend-verification', [
|
||||
'email' => 'resend@example.com',
|
||||
])->assertRedirect('/register/notice');
|
||||
|
||||
Queue::assertPushed(SendVerificationEmailJob::class, 2);
|
||||
Queue::assertPushed(SendVerificationEmailJob::class, 1);
|
||||
|
||||
expect(User::query()->where('email', 'resend@example.com')->exists())->toBeTrue();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user