From 495d46a284a8e8b915b043e95105ca92114f197d Mon Sep 17 00:00:00 2001 From: Jon Baker Date: Tue, 1 Nov 2016 15:12:28 -0500 Subject: [PATCH] Laravel 5.3 no longer ships with the Event.php abstract class --- src/Events/LinkClickedEvent.php | 3 +-- src/Events/ViewEmailEvent.php | 3 +-- tests/MailTrackerTest.php | 10 +++++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Events/LinkClickedEvent.php b/src/Events/LinkClickedEvent.php index 7aae0e8..bf71b5e 100644 --- a/src/Events/LinkClickedEvent.php +++ b/src/Events/LinkClickedEvent.php @@ -3,10 +3,9 @@ namespace jdavidbakr\MailTracker\Events; use jdavidbakr\MailTracker\Model\SentEmail; -use App\Events\Event; use Illuminate\Queue\SerializesModels; -class LinkClickedEvent extends Event +class LinkClickedEvent { use SerializesModels; diff --git a/src/Events/ViewEmailEvent.php b/src/Events/ViewEmailEvent.php index a3cf32d..abe4e55 100644 --- a/src/Events/ViewEmailEvent.php +++ b/src/Events/ViewEmailEvent.php @@ -3,10 +3,9 @@ namespace jdavidbakr\MailTracker\Events; use jdavidbakr\MailTracker\Model\SentEmail; -use App\Events\Event; use Illuminate\Queue\SerializesModels; -class ViewEmailEvent extends Event +class ViewEmailEvent { use SerializesModels; diff --git a/tests/MailTrackerTest.php b/tests/MailTrackerTest.php index 5b03707..2bef622 100644 --- a/tests/MailTrackerTest.php +++ b/tests/MailTrackerTest.php @@ -26,6 +26,8 @@ public function testPing() { $track = \jdavidbakr\MailTracker\Model\SentEmail::first(); + Event::fake(); + $pings = $track->opens; $pings++; @@ -34,12 +36,16 @@ public function testPing() $track = $track->fresh(); $this->assertEquals($pings, $track->opens); + + Event::assertFired(jdavidbakr\MailTracker\Events\ViewEmailEvent::class); } public function testLink() { $track = \jdavidbakr\MailTracker\Model\SentEmail::first(); + Event::fake(); + $clicks = $track->clicks; $clicks++; @@ -62,5 +68,7 @@ public function testLink() ]); $this->call('GET',$url); $this->assertRedirectedTo($redirect); + + Event::assertFired(jdavidbakr\MailTracker\Events\LinkClickedEvent::class); } -} \ No newline at end of file +}