Skip to content

A free open source IT asset/license management system

Add failing test

Marcus Moorec2123e307a8f
diff --git a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php
index ed536c7047..4a3ee4001a 100644
--- a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php
+++ b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php
@@ -136,4 +136,28 @@ class AssetAcceptanceTest extends TestCase
->exists()
);
}
+
+ public function testActionLoggedWhenDecliningAsset()
+ {
+ $checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();
+
+ $this->actingAs($checkoutAcceptance->assignedTo)
+ ->post(route('account.store-acceptance', $checkoutAcceptance), [
+ 'asset_acceptance' => 'declined',
+ 'note' => 'my note',
+ ]);
+
+ $this->assertTrue(Actionlog::query()
+ ->where([
+ 'action_type' => 'declined',
+ 'target_id' => $checkoutAcceptance->assignedTo->id,
+ 'target_type' => User::class,
+ 'note' => 'my note',
+ 'item_type' => Asset::class,
+ 'item_id' => $checkoutAcceptance->checkoutable->id,
+ ])
+ ->whereNotNull('action_date')
+ ->exists()
+ );
+ }
}