Skip to content

A free open source IT asset/license management system

Improve readability

Marcus Moore24e5cf81210e
diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php
index 733c52668e..38df7e58e4 100644
--- a/database/factories/CategoryFactory.php
+++ b/database/factories/CategoryFactory.php
@@ -214,4 +214,19 @@ class CategoryFactory extends Factory
'require_acceptance' => false,
]);
}
+
+ public function doesNotSendCheckinEmail()
+ {
+ return $this->state([
+ 'checkin_email' => false,
+ ]);
+ }
+
+ public function hasLocalEula()
+ {
+ return $this->state([
+ 'use_default_eula' => false,
+ 'eula_text' => 'Some EULA text here',
+ ]);
+ }
}
diff --git a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php
index 89adf45c28..a9647b2e3d 100644
--- a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php
+++ b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php
@@ -109,15 +109,15 @@ class BulkCheckoutEmailTest extends TestCase
public function test_email_is_sent_when_assets_do_not_require_acceptance_but_have_a_eula()
{
- $this->assets = Asset::factory()->doesNotRequireAcceptance()->count(2)->create();
+ $this->assets = Asset::factory()->count(2)->create();
- $category = Category::factory()->doesNotRequireAcceptance()->create([
- 'use_default_eula' => false,
- 'eula_text' => 'Some EULA text here',
- 'checkin_email' => false,
- ]);
+ $category = Category::factory()
+ ->doesNotRequireAcceptance()
+ ->doesNotSendCheckinEmail()
+ ->hasLocalEula()
+ ->create();
- $this->assets->first()->model->category()->associate($category)->save();
+ $this->assets->each(fn($asset) => $asset->model->category()->associate($category)->save());
$this->sendRequest();