diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index b628ba85ef..c0b3662646 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -68,6 +68,7 @@ class CheckoutableListener if ($notifiable instanceof User && $notifiable->email != '') { if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { + Mail::to($notifiable)->send($mailable); Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default')); } diff --git a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php index 2b7b91058c..7adab09c03 100644 --- a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php +++ b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php @@ -159,7 +159,7 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem 'checkout_to_type' => 'user', ]); - Mail::assertNotSent(CheckoutAccessoryMail::class, function ($mail) use ($user) { + Mail::assertSent(CheckoutAccessoryMail::class, function ($mail) use ($user) { return $mail->hasTo($user->email); }); } diff --git a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php index 1b4a9ea331..fba2c50df3 100644 --- a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php +++ b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php @@ -64,7 +64,9 @@ class ConsumableCheckoutTest extends TestCase 'assigned_to' => $user->id, ]); - Mail::assertSent($user, CheckoutConsumableMail::class); + Mail::assertSent(CheckoutConsumableMail::class, function ($mail) use ($consumable, $user) { + return $mail->hasTo($user->email); + }); } public function testActionLogCreatedUponCheckout() diff --git a/tests/Feature/Importing/Api/ImportAssetsTest.php b/tests/Feature/Importing/Api/ImportAssetsTest.php index 58d3a83ecb..ab98cc95e8 100644 --- a/tests/Feature/Importing/Api/ImportAssetsTest.php +++ b/tests/Feature/Importing/Api/ImportAssetsTest.php @@ -140,9 +140,8 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq //Notes is never read. // $this->assertEquals($row['notes'], $newAsset->notes); - Mail::assertSent(CheckoutAssetMail::class, function ($mail) use ($assignee) { - return $mail->hasTo($assignee->email); - }); + Mail::assertSent(CheckoutAssetMail::class); + } #[Test] diff --git a/tests/Support/AssertsAgainstSlackNotifications.php b/tests/Support/AssertsAgainstSlackNotifications.php index e52f39a7e5..11e6beea2d 100644 --- a/tests/Support/AssertsAgainstSlackNotifications.php +++ b/tests/Support/AssertsAgainstSlackNotifications.php @@ -14,7 +14,6 @@ trait AssertsAgainstSlackNotifications new AnonymousNotifiable, $notificationClass, function ($notification, $channels, $notifiable) { - dd($notification); return $notifiable->routes['slack'] === Setting::getSettings()->webhook_endpoint; } ); diff --git a/tests/Unit/NotificationTest.php b/tests/Unit/NotificationTest.php index 16350e117e..3d5b3c5a76 100644 --- a/tests/Unit/NotificationTest.php +++ b/tests/Unit/NotificationTest.php @@ -33,7 +33,9 @@ class NotificationTest extends TestCase Mail::fake(); $asset->checkOut($user, $admin->id); - Mail::assertSent($user, CheckoutAssetMail::class); + Mail::assertSent(CheckoutAssetMail::class, function ($mail) use ($user) { + return $mail->hasTo($user->email); + }); } public function testDefaultEulaIsSentWhenSetInCategory() {