mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Implement test
This commit is contained in:
parent
72eda1e909
commit
d371d14c1f
|
@ -8,6 +8,7 @@ use App\Models\LicenseSeat;
|
||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
use App\Models\Statuslabel;
|
use App\Models\Statuslabel;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
@ -177,6 +178,18 @@ class AssetCheckoutTest extends TestCase
|
||||||
|
|
||||||
public function testLastCheckoutUsesCurrentDateIfNotProvided()
|
public function testLastCheckoutUsesCurrentDateIfNotProvided()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$asset = Asset::factory()->create();
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->checkoutAssets()->create())
|
||||||
|
->post(route('hardware.checkout.store', $asset), [
|
||||||
|
'checkout_to_type' => 'user',
|
||||||
|
'assigned_user' => User::factory()->create()->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$asset->refresh();
|
||||||
|
|
||||||
|
// It's possible that this can be properly mocked in the future:
|
||||||
|
// https://laravel.com/docs/8.x/mocking#interacting-with-time
|
||||||
|
$this->assertTrue(Carbon::parse($asset->last_checkout)->diffInSeconds(now()) < 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue