Skip to content

A free open source IT asset/license management system

Add failing test

Marcus Moore9e3b56f4bc00
diff --git a/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php b/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php
index 6f6f250b90..51d945cb2f 100644
--- a/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php
+++ b/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php
@@ -187,4 +187,31 @@ class BulkAssetCheckoutTest extends TestCase
// ensure redirected back
$response->assertRedirectToRoute('hardware.bulkcheckout.show');
}
+
+ public function test_one_email_is_sent_instead_of_multiple_individual_ones()
+ {
+ Mail::fake();
+
+ $assets = Asset::factory()->requiresAcceptance()->count(2)->create();
+ $user = User::factory()->create(['email' => '[email protected]']);
+
+ $this->actingAs(User::factory()->checkoutAssets()->viewAssets()->create())
+ ->followingRedirects()
+ ->post(route('hardware.bulkcheckout.store'), [
+ 'selected_assets' => $assets->pluck('id')->toArray(),
+ 'checkout_to_type' => 'user',
+ 'assigned_user' => $user->id,
+ 'assigned_asset' => null,
+ 'note' => null,
+ ])
+ ->assertOk();
+
+ $assets->fresh()->each(function ($asset) {
+ $this->assertHasTheseActionLogs($asset, ['create', 'checkout']);
+ });
+
+ Mail::assertSent(CheckoutAssetMail::class, 0);
+
+ $this->markTestIncomplete('assert one email sent for both assets');
+ }
}