'tenants/logo.png', 'filename' => 'logo.png', 'type' => AttachmentType::Image, 'mime_type' => 'image/png', 'extension' => 'png', ]); $tenant = Tenant::create([ 'codigo' => 'acme', 'nombre' => 'Acme Store', 'dominio' => 'acme.example.com', 'primary_color' => '#778899', 'secondary_color' => '#64748b', 'danger_color' => '#dc2626', 'success_color' => '#16a34a', 'header_bg_color' => '#112233', 'footer_bg_color' => '#445566', 'header_logo_id' => $logo->id, 'footer_logo_id' => $logo->id, ]); Integration::create([ 'integration_code' => 'email', 'name' => 'Email', ]); TenantIntegration::create([ 'tenant_code' => $tenant->codigo, 'integration_code' => 'email', 'integration_data' => [ 'MAIL_SCHEME' => 'smtp', 'MAIL_HOST' => 'smtp.example.com', 'MAIL_PORT' => 587, 'MAIL_USERNAME' => 'mailer@example.com', 'MAIL_PASSWORD' => 'secret', 'MAIL_FROM_ADDRESS' => 'store@example.com', 'MAIL_FROM_NAME' => 'Acme Mail', ], ]); $mailer = Mockery::mock(Mailer::class); $mailer->shouldReceive('alwaysFrom') ->once() ->with('store@example.com', 'Acme Mail'); $manager = Mockery::mock(MailManager::class); $manager->shouldReceive('build') ->once() ->with(Mockery::on(fn (array $config): bool => $config === [ 'name' => 'tenant-smtp-acme', 'transport' => 'smtp', 'scheme' => 'smtp', 'host' => 'smtp.example.com', 'port' => 587, 'username' => 'mailer@example.com', 'password' => 'secret', 'timeout' => null, 'local_domain' => null, ])) ->andReturn($mailer); $service = new MailService($tenant, $manager); $this->assertSame('tenant-smtp', $service->mailerName()); } }