Skip to content

A free open source IT asset/license management system

Scaffold additional tests

Marcus Moore0506f3bef978
diff --git a/tests/Feature/Api/Assets/AssetCheckinTest.php b/tests/Feature/Api/Assets/AssetCheckinTest.php
index 7e5098bcef..85104052c1 100644
--- a/tests/Feature/Api/Assets/AssetCheckinTest.php
+++ b/tests/Feature/Api/Assets/AssetCheckinTest.php
@@ -16,27 +16,27 @@ class AssetCheckinTest extends TestCase
$this->markTestIncomplete();
}
- public function testAssetCheckedOutToAssetCanBeCheckedIn()
+ public function testCannotCheckInNonExistentAsset()
{
$this->markTestIncomplete();
}
- public function testAssetCheckedOutToLocationCanBeCheckedIn()
+ public function testCannotCheckInAssetThatIsNotCheckedOut()
{
$this->markTestIncomplete();
}
- public function testAssetCheckedOutToUserCanBeCheckedIn()
+ public function testAssetCheckedOutToAssetCanBeCheckedIn()
{
$this->markTestIncomplete();
}
- public function testCheckInEmailSentToUserIfSettingEnabled()
+ public function testAssetCheckedOutToLocationCanBeCheckedIn()
{
$this->markTestIncomplete();
}
- public function testCheckInEmailNotSentToUserIfSettingDisabled()
+ public function testAssetCheckedOutToUserCanBeCheckedIn()
{
$this->markTestIncomplete();
}
@@ -57,4 +57,19 @@ class AssetCheckinTest extends TestCase
'last_checkin field should be set on checkin'
);
}
+
+ public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testCheckInEmailSentToUserIfSettingEnabled()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testCheckInEmailNotSentToUserIfSettingDisabled()
+ {
+ $this->markTestIncomplete();
+ }
}
diff --git a/tests/Feature/Checkins/AssetCheckinTest.php b/tests/Feature/Checkins/AssetCheckinTest.php
index 92a8c29615..95cf639f82 100644
--- a/tests/Feature/Checkins/AssetCheckinTest.php
+++ b/tests/Feature/Checkins/AssetCheckinTest.php
@@ -24,6 +24,16 @@ class AssetCheckinTest extends TestCase
->assertForbidden();
}
+ public function testCannotCheckInNonExistentAsset()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testCannotCheckInAssetThatIsNotCheckedOut()
+ {
+ $this->markTestIncomplete();
+ }
+
public function testAssetCheckedOutToAssetCanBeCheckedIn()
{
$this->markTestIncomplete();
@@ -45,13 +55,36 @@ class AssetCheckinTest extends TestCase
$this->assertTrue($asset->assignedTo->is($user));
$this->actingAs($admin)
- ->post(route('hardware.checkin.store', ['assetId' => $asset->id]))
- ->assertRedirect();
+ ->post(route('hardware.checkin.store', ['assetId' => $asset->id, 'backto' => 'user']))
+ ->assertRedirect(route('users.show', $user));
$this->assertNull($asset->fresh()->assignedTo);
Event::assertDispatched(CheckoutableCheckedIn::class, 1);
}
+ public function testLastCheckInFieldIsSetOnCheckin()
+ {
+ $admin = User::factory()->superuser()->create();
+ $asset = Asset::factory()->create(['last_checkin' => null]);
+
+ $asset->checkOut(User::factory()->create(), $admin, now());
+
+ $this->actingAs($admin)
+ ->post(route('hardware.checkin.store', [
+ 'assetId' => $asset->id,
+ ]));
+
+ $this->assertNotNull(
+ $asset->fresh()->last_checkin,
+ 'last_checkin field should be set on checkin'
+ );
+ }
+
+ public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
+ {
+ $this->markTestIncomplete();
+ }
+
public function testCheckInEmailSentToUserIfSettingEnabled()
{
Notification::fake();
@@ -99,22 +132,4 @@ class AssetCheckinTest extends TestCase
}
);
}
-
- public function testLastCheckInFieldIsSetOnCheckin()
- {
- $admin = User::factory()->superuser()->create();
- $asset = Asset::factory()->create(['last_checkin' => null]);
-
- $asset->checkOut(User::factory()->create(), $admin, now());
-
- $this->actingAs($admin)
- ->post(route('hardware.checkin.store', [
- 'assetId' => $asset->id,
- ]));
-
- $this->assertNotNull(
- $asset->fresh()->last_checkin,
- 'last_checkin field should be set on checkin'
- );
- }
}