mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 22:37:28 -08:00
Finish implementing test case
This commit is contained in:
parent
deaba46e1c
commit
6f53f2ac64
|
@ -9,13 +9,10 @@ use App\Models\Location;
|
|||
use App\Models\Statuslabel;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Tests\Support\InteractsWithSettings;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AssetCheckoutTest extends TestCase
|
||||
{
|
||||
use InteractsWithSettings;
|
||||
|
||||
public function testCheckingOutAssetRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
|
@ -77,8 +74,6 @@ class AssetCheckoutTest extends TestCase
|
|||
|
||||
public function testAnAssetCanBeCheckedOutToAUser()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
|
||||
Event::fake([CheckoutableCheckedOut::class]);
|
||||
|
||||
$originalStatus = Statuslabel::factory()->readyToDeploy()->create();
|
||||
|
@ -100,11 +95,13 @@ class AssetCheckoutTest extends TestCase
|
|||
'note' => 'An awesome note',
|
||||
]);
|
||||
|
||||
// @todo: ensure asset updated
|
||||
$asset->refresh();
|
||||
$this->assertTrue($asset->assignedTo()->is($user));
|
||||
$this->assertTrue($asset->location->is($userLocation));
|
||||
$this->assertEquals('2024-03-28 00:00:00', (string)$asset->expected_checkin);
|
||||
$this->assertEquals('Changed Name', $asset->name);
|
||||
$this->assertTrue($asset->assetstatus->is($updatedStatus));
|
||||
$this->assertEquals('2024-03-18 00:00:00', $asset->last_checkout);
|
||||
$this->assertEquals('2024-03-28 00:00:00', (string)$asset->expected_checkin);
|
||||
|
||||
Event::assertDispatched(function (CheckoutableCheckedOut $event) use ($admin, $asset, $user) {
|
||||
return $event->checkoutable->is($asset)
|
||||
|
@ -112,8 +109,6 @@ class AssetCheckoutTest extends TestCase
|
|||
&& $event->checkedOutBy->is($admin)
|
||||
&& $event->note === 'An awesome note';
|
||||
});
|
||||
|
||||
// @todo: assert action log entry created
|
||||
}
|
||||
|
||||
public function testLicenseSeatsAreAssignedToUserUponCheckout()
|
||||
|
|
Loading…
Reference in a new issue