From c20a66ed48beff4c878928b7bda49763a3192e54 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 4 Jan 2017 20:42:14 +0000 Subject: [PATCH] Fix tests --- .../Incident/IncidentWasReportedEvent.php | 2 +- .../Events/User/UserAcceptedInviteEvent.php | 1 + .../ComponentStatusWasUpdatedEventTest.php | 2 +- .../Incident/IncidentWasReportedEventTest.php | 5 ++- .../User/UserAcceptedInviteEventTest.php | 40 +++++++++++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 tests/Bus/Events/User/UserAcceptedInviteEventTest.php diff --git a/app/Bus/Events/Incident/IncidentWasReportedEvent.php b/app/Bus/Events/Incident/IncidentWasReportedEvent.php index 9556b32f..b361a4d4 100644 --- a/app/Bus/Events/Incident/IncidentWasReportedEvent.php +++ b/app/Bus/Events/Incident/IncidentWasReportedEvent.php @@ -37,7 +37,7 @@ final class IncidentWasReportedEvent implements IncidentEventInterface * * @return void */ - public function __construct(Incident $incident, $notify) + public function __construct(Incident $incident, $notify = false) { $this->incident = $incident; $this->notify = $notify; diff --git a/app/Bus/Events/User/UserAcceptedInviteEvent.php b/app/Bus/Events/User/UserAcceptedInviteEvent.php index 3a040799..776db37e 100644 --- a/app/Bus/Events/User/UserAcceptedInviteEvent.php +++ b/app/Bus/Events/User/UserAcceptedInviteEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Models\Invite; use CachetHQ\Cachet\Models\User; /** diff --git a/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php b/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php index 4747ca3b..c8ae1e3a 100644 --- a/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php +++ b/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php @@ -40,7 +40,7 @@ class ComponentStatusWasUpdatedEventTest extends AbstractComponentEventTestCase $this->app['events']->fire(new ComponentStatusWasUpdatedEvent($component, 1, 2)); $this->seeMessageFor($subscriber->email); - $this->seeMessageWithSubject(trans('cachet.subscriber.email.component.subject')); + $this->seeMessageWithSubject(trans('notifications.component.status_update.subject')); $message = $this->getMailer()->lastMessage(); diff --git a/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php b/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php index c6f880f6..6f45ae4d 100644 --- a/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php +++ b/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php @@ -28,7 +28,10 @@ class IncidentWasReportedEventTest extends AbstractIncidentEventTestCase protected function getObjectAndParams() { - $params = ['incident' => new Incident()]; + $params = [ + 'incident' => new Incident(), + 'notify' => true, + ]; $object = new IncidentWasReportedEvent($params['incident']); return compact('params', 'object'); diff --git a/tests/Bus/Events/User/UserAcceptedInviteEventTest.php b/tests/Bus/Events/User/UserAcceptedInviteEventTest.php new file mode 100644 index 00000000..e948fc76 --- /dev/null +++ b/tests/Bus/Events/User/UserAcceptedInviteEventTest.php @@ -0,0 +1,40 @@ + + */ +class UserAcceptedInviteEventTest extends AbstractUserEventTestCase +{ + protected function objectHasHandlers() + { + return false; + } + + protected function getObjectAndParams() + { + $params = [ + 'user' => new User(), + 'invite' => new Invite(), + ]; + $object = new UserAcceptedInviteEvent($params['user'], $params['invite']); + + return compact('params', 'object'); + } +}