Skip to content

Commit

Permalink
fix listener
Browse files Browse the repository at this point in the history
  • Loading branch information
herpaderpaldent committed Nov 23, 2023
1 parent d8b5769 commit 223ca7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/Listeners/NotificationFailedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function handle(NotificationFailed $notificationFailed)
// get connector type from recipient
$connector_type = $notificationFailed->recipient->connector_type;

//dd($connector_type, $connector_type::class);

// find the notification class that is implemented by the connector
try {
$error_notification = $connector_type::findImplementedNotificationClass(ErrorNotification::class);
Expand Down
19 changes: 11 additions & 8 deletions tests/Unit/Events/NotificationFailedEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
Notification::fake();

$notification = $this->mock(ErrorNotification::class);

$connector = new class
{
public static function findImplementedNotificationClass($class)
{
throw new \Exception('test');
}
};

$this->notification_failed = new \Seatplus\BroadcastHub\Events\NotificationFailed(
recipient: Recipient::factory()->make([
'connector_type' => new class
{
public static function findImplementedNotificationClass($class)
{
throw new \Exception('test');
}
},
'connector_type' => $connector::class,
]),
message: $notification,
exception: new \Exception('test'),
Expand Down Expand Up @@ -57,7 +60,7 @@ public static function findImplementedNotificationClass($class)
});

$recipient = Recipient::factory()->make([
'connector_type' => $connector_mock,
'connector_type' => $connector_mock::class,
]);

$failed_notification = new ErrorNotificationStub(
Expand Down

0 comments on commit 223ca7c

Please sign in to comment.