Skip to content

A free open source IT asset/license management system

adds test

Godfrey Mf04a4a3cf515
diff --git a/app/View/Label.php b/app/View/Label.php
index 8868306591..07152ccd2c 100644
--- a/app/View/Label.php
+++ b/app/View/Label.php
@@ -158,8 +158,8 @@ class Label implements View
// The end result of this will be in this format:
// {labelOne} {valueOne} | {labelTwo} {valueTwo} | {labelThree} {valueThree}
$previous['value'] = trim(implode(' | ', [
- implode(' ', [$previous['label'], $previous['value']]),
- implode(' ', [$current['label'], $current['value']]),
+ implode(' ', [$previous['label'], str_replace(['{', '}'], '', $previous['value'])]),
+ implode(' ', [$current['label'], str_replace(['{', '}'], '', $current['value'])]),
]));
// We'll set the label to an empty string since we
diff --git a/tests/Unit/NotificationTest.php b/tests/Unit/NotificationTest.php
index 8005759a1e..86177c3030 100644
--- a/tests/Unit/NotificationTest.php
+++ b/tests/Unit/NotificationTest.php
@@ -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');
+ });
+ }
}