Skip to content

Commit

Permalink
Merge pull request #1 from notz/fix-test-data
Browse files Browse the repository at this point in the history
fix: Test data
  • Loading branch information
notz authored Jun 14, 2024
2 parents b9015dd + 6cad191 commit 177164e
Showing 1 changed file with 41 additions and 45 deletions.
86 changes: 41 additions & 45 deletions Tests/Functional/EventSubscriber/CallbackSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testPostalTransportNotConfigured(): void

public function testPostalCallbackProcessWithMessageFailed(): void
{
$parameters = $this->getFailedParameters();
$parameters = $this->getDeliveryFailedParameters();

$contact = $this->createContact('[email protected]');
$this->em->flush();
Expand All @@ -47,7 +47,7 @@ public function testPostalCallbackProcessWithMessageFailed(): void

$dnc = $contact->getDoNotContact()->current();
Assert::assertSame('email', $dnc->getChannel());
Assert::assertSame('Hard bounce', $dnc->getComments());
Assert::assertSame('Delivery failed', $dnc->getComments());
Assert::assertSame($nowFormatted, $dnc->getDateAdded()->format(DateTimeHelper::FORMAT_DB));
Assert::assertSame($contact, $dnc->getLead());
Assert::assertSame(DoNotContact::BOUNCED, $dnc->getReason());
Expand All @@ -70,7 +70,7 @@ public function testPostalCallbackProcessWithMessageBounced(): void

$dnc = $contact->getDoNotContact()->current();
Assert::assertSame('email', $dnc->getChannel());
Assert::assertSame('Delivery failed', $dnc->getComments());
Assert::assertSame('Hard bounce', $dnc->getComments());
Assert::assertSame($nowFormatted, $dnc->getDateAdded()->format(DateTimeHelper::FORMAT_DB));
Assert::assertSame($contact, $dnc->getLead());
Assert::assertSame(DoNotContact::BOUNCED, $dnc->getReason());
Expand All @@ -79,24 +79,22 @@ public function testPostalCallbackProcessWithMessageBounced(): void
/**
* @return array<mixed>
*/
private function getFailedParameters(): array
private function getDeliveryFailedParameters(): array
{
return [
[
'event' => 'MessageFailed',
'payload' => [
'message' => [
'id' => '12345',
'token' => 'abcdef123',
'direction' => 'outgoing',
'message_id' => '[email protected]',
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Welcome to AwesomeApp',
'timestamp' => 1477945177.12994,
'spam_status' => 'NotSpam',
'tag' => 'welcome',
],
'event' => 'MessageDeliveryFailed',
'payload' => [
'message' => [
'id' => '12345',
'token' => 'abcdef123',
'direction' => 'outgoing',
'message_id' => '[email protected]',
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Welcome to AwesomeApp',
'timestamp' => 1477945177.12994,
'spam_status' => 'NotSpam',
'tag' => 'welcome',
],
],
];
Expand All @@ -108,32 +106,30 @@ private function getFailedParameters(): array
private function getBouncedParameters(): array
{
return [
[
'event' => 'MessageBounced',
'payload' => [
'original_message' => [
'id' => '12345',
'token' => 'abcdef123',
'direction' => 'outgoing',
'message_id' => '[email protected]',
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Welcome to AwesomeApp',
'timestamp' => 1477945177.12994,
'spam_status' => 'NotSpam',
'tag' => 'welcome',
],
'bounce' => [
'id' => '12345',
'token' => 'abcdef124',
'direction' => 'incoming',
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Delivery Error',
'timestamp' => 1477945179.12994,
'spam_status' => 'NotSpam',
'tag' => null,
],
'event' => 'MessageBounced',
'payload' => [
'original_message' => [
'id' => '12345',
'token' => 'abcdef123',
'direction' => 'outgoing',
'message_id' => '[email protected]',
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Welcome to AwesomeApp',
'timestamp' => 1477945177.12994,
'spam_status' => 'NotSpam',
'tag' => 'welcome',
],
'bounce' => [
'id' => '12345',
'token' => 'abcdef124',
'direction' => 'incoming',
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Delivery Error',
'timestamp' => 1477945179.12994,
'spam_status' => 'NotSpam',
'tag' => null,
],
],
];
Expand Down

0 comments on commit 177164e

Please sign in to comment.