Skip to content

A free open source IT asset/license management system

Implement test

Marcus Mooreb653d1957941
diff --git a/tests/Feature/Checkins/AssetCheckinTest.php b/tests/Feature/Checkins/AssetCheckinTest.php
index 6b0fdd0e7a..f3518d11ba 100644
--- a/tests/Feature/Checkins/AssetCheckinTest.php
+++ b/tests/Feature/Checkins/AssetCheckinTest.php
@@ -35,7 +35,7 @@ class AssetCheckinTest extends TestCase
$this->markTestIncomplete();
}
- public function testAssetCheckedOutToUserCanBeCheckedIn()
+ public function testAssetCanBeCheckedIn()
{
Event::fake([CheckoutableCheckedIn::class]);
@@ -72,14 +72,22 @@ class AssetCheckinTest extends TestCase
$this->assertEquals($status->id, $asset->status_id);
}
- public function testAssetCheckedOutToAssetCanBeCheckedIn()
+ public function testCheckinTimeAndActionLogNoteCanBeSet()
{
- $this->markTestIncomplete();
- }
-
- public function testAssetCheckedOutToLocationCanBeCheckedIn()
- {
- $this->markTestIncomplete();
+ Event::fake();
+
+ $this->actingAs(User::factory()->checkinAssets()->create())
+ ->post(route(
+ 'hardware.checkin.store',
+ ['assetId' => Asset::factory()->assignedToUser()->create()->id]
+ ), [
+ 'checkin_at' => '2023-01-02 12:45:56',
+ 'note' => 'hello'
+ ]);
+
+ Event::assertDispatched(function (CheckoutableCheckedIn $event) {
+ return $event->action_date === '2023-01-02 12:45:56' && $event->note === 'hello';
+ }, 1);
}
public function testLastCheckInFieldIsSetOnCheckin()