A free open source IT asset/license management system
Add failing test
Marcus Moore33c156be1604
diff --git a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.phpindex 9fabf5771b..c6dd056cfb 100644--- a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php+++ b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php@@ -4,14 +4,32 @@ namespace Tests\Feature\Notifications\Email;use App\Events\CheckoutablesCheckedOutInBulk;use App\Mail\BulkAssetCheckoutMail;+use App\Mail\CheckoutAssetMail;use App\Models\Asset;use App\Models\User;-use App\Notifications\CheckoutAssetNotification;use Illuminate\Support\Facades\Mail;use Tests\TestCase;class BulkCheckoutEmailTest extends TestCase{+ private $assets;+ private $target;+ private $admin;+ private $checkout_at;+ private $expected_checkin;++ protected function setUp(): void+ {+ parent::setUp();++ $this->assets = Asset::factory()->count(2)->create();+ $this->target = User::factory()->create(['email' => '[email protected]']);+ $this->admin = User::factory()->create();+ $this->checkout_at = date('Y-m-d H:i:s');+ $this->expected_checkin = '';+ }++ // @todo:public static function scenarios(){// 'User has email address set@@ -20,34 +38,21 @@ class BulkCheckoutEmailTest extends TestCase// 'webhook is set'}- public function test_email_is_sent()+ public function test_email_is_sent_to_cc_address(){$this->settings->enableAdminCC('[email protected]');Mail::fake();- $assets = Asset::factory()->count(2)->create();- $target = User::factory()->create(['email' => '[email protected]']);- $admin = User::factory()->create();- $checkout_at = date('Y-m-d H:i:s');- $expected_checkin = '';-- CheckoutablesCheckedOutInBulk::dispatch(- $assets,- $target,- $admin,- $checkout_at,- $expected_checkin,- 'A note here',- );+ $this->dispatchEvent();- Mail::assertNotSent(CheckoutAssetNotification::class);+ Mail::assertNotSent(CheckoutAssetMail::class);Mail::assertSent(BulkAssetCheckoutMail::class, 2);Mail::assertSent(BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $mail) {// @todo: assert contents- return $mail->hasTo('[email protected]');+ return $mail->hasTo($this->target->email);});Mail::assertSent(BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $mail) {@@ -55,4 +60,21 @@ class BulkCheckoutEmailTest extends TestCasereturn $mail->hasTo('[email protected]');});}++ public function test_webbook_is_sent()+ {+ $this->markTestIncomplete();+ }++ private function dispatchEvent(): void+ {+ CheckoutablesCheckedOutInBulk::dispatch(+ $this->assets,+ $this->target,+ $this->admin,+ $this->checkout_at,+ $this->expected_checkin,+ 'A note here',+ );+ }}