feat(notification): add PDF attachments to ticket availability emails

This commit is contained in:
2026-08-26 08:54:15 -03:00
parent bf02d37a33
commit 8220fb5aaf
5 changed files with 52 additions and 6 deletions

View File

@@ -192,11 +192,16 @@ class NotificationMailServiceTest extends TestCase
&& str_contains($mail->render(), 'border-top: 4px solid #112233')
&& ! str_contains($mail->render(), 'border-top: 4px solid #ff7006');
});
Mail::assertSent(Mailable::class, function (Mailable $mail): bool {
Mail::assertSent(Mailable::class, function (Mailable $mail) use ($ticket): bool {
$mail->assertTo('checkout@example.com');
$attachment = collect($mail->rawAttachments)->firstWhere('name', "tickets_{$ticket->id}.pdf");
return $mail->subject === 'Tus tickets ya están disponibles'
&& str_contains($mail->render(), 'Entrada general')
&& str_contains($mail->render(), 'El ticket está adjunto')
&& $attachment !== null
&& $attachment['options'] === ['mime' => 'application/pdf']
&& str_starts_with($attachment['data'], '%PDF-')
&& str_contains($mail->render(), 'border-top: 4px solid #112233')
&& ! str_contains($mail->render(), 'border-top: 4px solid #ff7006');
});