mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
Implement tests
This commit is contained in:
parent
9ab56fe9ca
commit
ad1846fed6
|
@ -13,40 +13,34 @@ class AssetCheckinTest extends TestCase
|
||||||
|
|
||||||
public function testCheckingInAssetRequiresCorrectPermission()
|
public function testCheckingInAssetRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()))
|
||||||
|
->assertForbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCannotCheckInNonExistentAsset()
|
public function testCannotCheckInNonExistentAsset()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||||
|
->postJson(route('api.asset.checkin', ['id' => 'does-not-exist']))
|
||||||
|
->assertStatusMessageIs('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCannotCheckInAssetThatIsNotCheckedOut()
|
public function testCannotCheckInAssetThatIsNotCheckedOut()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||||
|
->postJson(route('api.asset.checkin', Asset::factory()->create()->id))
|
||||||
|
->assertStatusMessageIs('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAssetCheckedOutToAssetCanBeCheckedIn()
|
public function testAssetCanBeCheckedIn()
|
||||||
{
|
|
||||||
$this->markTestIncomplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAssetCheckedOutToLocationCanBeCheckedIn()
|
|
||||||
{
|
|
||||||
$this->markTestIncomplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAssetCheckedOutToUserCanBeCheckedIn()
|
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->markTestIncomplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLastCheckInFieldIsSetOnCheckin()
|
public function testLastCheckInFieldIsSetOnCheckin()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->superuser()->create();
|
$admin = User::factory()->checkinAssets()->create();
|
||||||
$asset = Asset::factory()->create(['last_checkin' => null]);
|
$asset = Asset::factory()->assignedToUser()->create(['last_checkin' => null]);
|
||||||
|
|
||||||
$asset->checkOut(User::factory()->create(), $admin, now());
|
|
||||||
|
|
||||||
$this->actingAsForApi($admin)
|
$this->actingAsForApi($admin)
|
||||||
->postJson(route('api.asset.checkin', $asset))
|
->postJson(route('api.asset.checkin', $asset))
|
||||||
|
|
|
@ -116,13 +116,10 @@ class AssetCheckinTest extends TestCase
|
||||||
|
|
||||||
public function testLastCheckInFieldIsSetOnCheckin()
|
public function testLastCheckInFieldIsSetOnCheckin()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->superuser()->create();
|
$admin = User::factory()->checkinAssets()->create();
|
||||||
$asset = Asset::factory()->assignedToUser()->create(['last_checkin' => null]);
|
$asset = Asset::factory()->assignedToUser()->create(['last_checkin' => null]);
|
||||||
|
|
||||||
$this->actingAs($admin)
|
$this->actingAs($admin)->post(route('hardware.checkin.store', ['assetId' => $asset->id]));
|
||||||
->post(route('hardware.checkin.store', [
|
|
||||||
'assetId' => $asset->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
$this->assertNotNull(
|
$this->assertNotNull(
|
||||||
$asset->refresh()->last_checkin,
|
$asset->refresh()->last_checkin,
|
||||||
|
|
Loading…
Reference in a new issue