'smtp', 'mail.mailers.smtp.host' => '127.0.0.1', 'mail.mailers.smtp.port' => 9, 'mail.mailers.smtp.timeout' => 1, ]); Exceptions::fake(); }); it('creates the user and asks for a resend when the email cannot be sent', function () { Livewire::actingAs(User::factory()->admin()->create()) ->test('users::form') ->set('form.name', 'Maija Meikäläinen') ->set('form.email', 'maija@example.test') ->call('save') ->assertHasNoErrors() ->assertRedirect(route('users.index')); expect(User::query()->where('email', 'maija@example.test')->exists())->toBeTrue() ->and(session('status'))->toContain('salasanan asetuslinkin lähetys epäonnistui'); Exceptions::assertReported(TransportException::class); }); it('tells the admin when a resend fails', function () { $user = User::factory()->create(['email' => 'eero@example.test']); Livewire::actingAs(User::factory()->admin()->create()) ->test('users::form', ['user' => $user->id]) ->call('sendPasswordLink') ->assertSee('Linkkiä ei voitu lähettää'); }); it('still creates the first admin from the command', function () { $this->artisan('users:create-admin', ['name' => 'Anna Admin', 'email' => 'anna@example.test']) ->expectsOutputToContain('could not be sent') ->assertSuccessful(); expect(User::query()->where('email', 'anna@example.test')->exists())->toBeTrue(); });