-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
94 additions
and
1,799 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ public function it_can_handle_multiple_events() | |
(new ProcessSendgridWebhookJob($this->webhookCall))->handle(); | ||
|
||
$this->assertEquals(2, SendFeedbackItem::count()); | ||
$this->assertEquals(SendFeedbackType::BOUNCE, SendFeedbackItem::first()->type); | ||
$this->assertEquals(SendFeedbackType::Bounce, SendFeedbackItem::first()->type); | ||
$this->assertTrue($this->send->is(SendFeedbackItem::first()->send)); | ||
} | ||
|
||
|
@@ -59,7 +59,7 @@ public function it_processes_a_sendgrid_complaint_webhook_call() | |
|
||
$this->assertEquals(1, SendFeedbackItem::count()); | ||
tap(SendFeedbackItem::first(), function (SendFeedbackItem $sendFeedbackItem) { | ||
$this->assertEquals(SendFeedbackType::COMPLAINT, $sendFeedbackItem->type); | ||
$this->assertEquals(SendFeedbackType::Complaint, $sendFeedbackItem->type); | ||
$this->assertEquals(Carbon::createFromTimestamp(1574854444), $sendFeedbackItem->created_at); | ||
$this->assertTrue($this->send->is($sendFeedbackItem->send)); | ||
}); | ||
|
@@ -86,6 +86,28 @@ public function it_processes_a_sendgrid_click_webhook_call() | |
$this->assertCount(1, CampaignLink::first()->clicks); | ||
} | ||
|
||
/** @test */ | ||
public function it_processes_a_sendgrid_click_webhook_call_with_message_id() | ||
{ | ||
$this->send->update(['transport_message_id' => '14c5d75ce93']); | ||
|
||
$payload = $this->getStub('clickPayload'); | ||
unset($payload['send_uuid']); | ||
|
||
$this->webhookCall->update(['payload' => $payload]); | ||
(new ProcessSendgridWebhookJob($this->webhookCall))->handle(); | ||
|
||
$this->assertEquals(1, CampaignLink::count()); | ||
$this->assertEquals('https://example.com', CampaignLink::first()->url); | ||
$this->assertCount(1, CampaignLink::first()->clicks); | ||
$this->assertEquals(Carbon::createFromTimestamp(1574854444), CampaignLink::first()->clicks->first()->created_at); | ||
|
||
$this->send->subscriber->update(['email' => '[email protected]']); | ||
(new ProcessSendgridWebhookJob($this->webhookCall))->handle(); | ||
$this->assertEquals(1, CampaignLink::count()); | ||
$this->assertCount(1, CampaignLink::first()->clicks); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_process_a_sendgrid_open_webhook_call() | ||
{ | ||
|
@@ -107,7 +129,7 @@ public function it_can_process_a_sendgrid_bounce_webhook_call() | |
(new ProcessSendgridWebhookJob($this->webhookCall))->handle(); | ||
|
||
$this->assertEquals(1, SendFeedbackItem::count()); | ||
$this->assertEquals(SendFeedbackType::BOUNCE, SendFeedbackItem::first()->type); | ||
$this->assertEquals(SendFeedbackType::Bounce, SendFeedbackItem::first()->type); | ||
$this->assertTrue($this->send->is(SendFeedbackItem::first()->send)); | ||
} | ||
|
||
|
@@ -126,7 +148,7 @@ public function it_wont_process_a_sendgrid_temporary_bounce_webhook_call() | |
/** @test */ | ||
public function it_will_fire_an_event_when_processing_is_complete() | ||
{ | ||
Event::fake(); | ||
Event::fake(WebhookCallProcessedEvent::class); | ||
|
||
$this->webhookCall->update(['payload' => $this->getStub('openPayload')]); | ||
(new ProcessSendgridWebhookJob($this->webhookCall))->handle(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.