adds test

This commit is contained in:
Godfrey M
2024-09-04 12:21:49 -07:00
parent cf07186ae8
commit f04a4a3cf5
2 changed files with 26 additions and 2 deletions
+24
View File
@@ -33,4 +33,28 @@ class NotificationTest extends TestCase
$asset->checkOut($user, $admin->id);
Notification::assertSentTo($user, CheckoutAssetNotification::class);
}
public function testDefaultEulaIsSentWhenSetInCategory()
{
Notification::fake();
$this->settings->setEula('My Custom EULA Text');
$user = User::factory()->create();
$category = Category::factory()->create([
'use_default_eula' => 1,
'eula_text' => 'EULA Text that should not be used',
]);
$model = AssetModel::factory()->for($category)->create();
$asset = Asset::factory()->for($model, 'model')->create();
$asset->checkOut($user, User::factory()->superuser()->create()->id);
Notification::assertSentTo($user, CheckoutAssetNotification::class, function ($notification) {
$content = $notification->toMail()->render();
return str_contains($content, 'My Custom EULA Text') && !str_contains($content, 'EULA Text that should not be used');
});
}
}