Skip to content

A free open source IT asset/license management system

Improve tests

Marcus Moore882d55fd09de
diff --git a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.php b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.php
index 790e48a877..b1035a1351 100644
--- a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.php
+++ b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.php
@@ -79,15 +79,15 @@ class EmailNotificationsUponCheckoutTest extends TestCase
public function test_handles_user_not_having_email_address_set()
{
- $this->markTestIncomplete();
-
$this->category->update(['checkin_email' => true]);
$this->user->update(['email' => null]);
$this->fireCheckoutEvent();
+
+ Mail::assertNothingSent();
}
- public function test_sends_alert_email()
+ public function test_alert_email_sends()
{
$this->settings->enableAdminCC('[email protected]');
@@ -111,6 +111,20 @@ class EmailNotificationsUponCheckoutTest extends TestCase
});
}
+ public function test_alert_email_still_sent_when_user_has_no_email_address()
+ {
+ $this->settings->enableAdminCC('[email protected]');
+
+ $this->category->update(['checkin_email' => true]);
+ $this->user->update(['email' => null]);
+
+ $this->fireCheckoutEvent();
+
+ Mail::assertSent(CheckoutAssetMail::class, function ($mail) {
+ return $mail->hasTo('[email protected]');
+ });
+ }
+
private function fireCheckoutEvent(): void
{
event(new CheckoutableCheckedOut(