Skip to content

A free open source IT asset/license management system

Add test case

Marcus Moore31a247b55b41
diff --git a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php
index c6dd056cfb..0e1ef6655f 100644
--- a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php
+++ b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php
@@ -22,6 +22,8 @@ class BulkCheckoutEmailTest extends TestCase
{
parent::setUp();
+ Mail::fake();
+
$this->assets = Asset::factory()->count(2)->create();
$this->target = User::factory()->create(['email' => '[email protected]']);
$this->admin = User::factory()->create();
@@ -38,12 +40,26 @@ class BulkCheckoutEmailTest extends TestCase
// 'webhook is set'
}
+ public function test_email_is_sent_to_user()
+ {
+ $this->settings->disableAdminCC();
+
+ $this->dispatchEvent();
+
+ Mail::assertNotSent(CheckoutAssetMail::class);
+
+ Mail::assertSent(BulkAssetCheckoutMail::class, 1);
+
+ Mail::assertSent(BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $mail) {
+ // @todo: assert contents
+ return $mail->hasTo($this->target->email);
+ });
+ }
+
public function test_email_is_sent_to_cc_address()
{
$this->settings->enableAdminCC('[email protected]');
- Mail::fake();
-
$this->dispatchEvent();
Mail::assertNotSent(CheckoutAssetMail::class);