feat(notification): add PDF attachments to ticket availability emails
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user