feat(integration): add requires_tenant_configuration field and update related logic and tests

This commit is contained in:
2026-07-22 09:23:58 -03:00
parent 03d8361e5f
commit 7e1ffbf417
9 changed files with 70 additions and 3 deletions

View File

@@ -57,6 +57,28 @@ class MailServiceTest extends TestCase
$this->assertSame('tenant-smtp', $service->mailerName());
}
public function test_it_uses_the_default_mailer_when_tenant_configuration_is_not_required(): void
{
Mail::fake();
config(['mail.default' => 'array']);
$tenant = $this->createTenant();
Integration::create([
'integration_code' => 'email',
'name' => 'Email',
'requires_tenant_configuration' => false,
]);
$service = (new MailService)->forTenant($tenant->codigo);
$service->send('customer@example.com', 'Default mailer', '<p>Fallback</p>');
$this->assertSame('array', $service->mailerName());
Mail::assertSent(Mailable::class, function (Mailable $mail): bool {
return $mail->hasTo('customer@example.com')
&& $mail->subject === 'Default mailer'
&& str_contains($mail->render(), 'Fallback');
});
}
public function test_on_setup_sends_a_branded_test_email_to_the_configured_sender(): void
{
Mail::fake();