Skip to content

Commit 186daa5

Browse files
ericabouafnicolas-grekas
authored andcommitted
[Webhook][RemoteEvent] fix SendgridPayloadConverter category support
1 parent 09c925b commit 186daa5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Symfony/Component/Mailer/Bridge/Sendgrid/RemoteEvent/SendgridPayloadConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function convert(array $payload): AbstractMailerEvent
5151
$event->setDate($date);
5252
$event->setRecipientEmail($payload['email']);
5353
$event->setMetadata([]);
54-
$event->setTags($payload['category'] ?? []);
54+
$event->setTags((array) ($payload['category'] ?? []));
5555

5656
return $event;
5757
}

src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/RemoteEvent/SendgridPayloadConverterTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,20 @@ public function testAsynchronousBounce()
112112
$this->assertInstanceOf(MailerDeliveryEvent::class, $event);
113113
$this->assertSame('123456', $event->getId());
114114
}
115+
116+
public function testWithStringCategory()
117+
{
118+
$converter = new SendgridPayloadConverter();
119+
120+
$event = $converter->convert([
121+
'event' => 'processed',
122+
'sg_message_id' => '123456',
123+
'timestamp' => '123456789',
124+
'email' => 'test@example.com',
125+
'category' => 'cat facts',
126+
]);
127+
128+
$this->assertInstanceOf(MailerDeliveryEvent::class, $event);
129+
$this->assertSame(['cat facts'], $event->getTags());
130+
}
115131
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy