Implement test
This commit is contained in:
parent
fa19686248
commit
832e50a71e
1 changed files with 13 additions and 0 deletions
|
@ -45,4 +45,17 @@ class AccessoryCheckinTest extends TestCase implements TestsFullMultipleCompanie
|
||||||
$this->assertEquals(1, $accessoryForCompanyB->fresh()->checkouts->count(), 'Accessory should not be checked in');
|
$this->assertEquals(1, $accessoryForCompanyB->fresh()->checkouts->count(), 'Accessory should not be checked in');
|
||||||
$this->assertEquals(0, $anotherAccessoryForCompanyB->fresh()->checkouts->count(), 'Accessory should be checked in');
|
$this->assertEquals(0, $anotherAccessoryForCompanyB->fresh()->checkouts->count(), 'Accessory should be checked in');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCanCheckinAccessory()
|
||||||
|
{
|
||||||
|
$accessory = Accessory::factory()->checkedOutToUser()->create();
|
||||||
|
|
||||||
|
$this->assertEquals(1, $accessory->checkouts->count());
|
||||||
|
|
||||||
|
$this->actingAsForApi(User::factory()->checkinAccessories()->create())
|
||||||
|
->postJson(route('api.accessories.checkin', $accessory))
|
||||||
|
->assertStatusMessageIs('success');
|
||||||
|
|
||||||
|
$this->assertEquals(0, $accessory->fresh()->checkouts->count(), 'Accessory should be checked in');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue