Implement test
This commit is contained in:
parent
29d729171c
commit
69022bb8b6
1 changed files with 4 additions and 6 deletions
|
@ -150,20 +150,18 @@ class AssetCheckinTest extends TestCase
|
||||||
|
|
||||||
public function testCheckinTimeAndActionLogNoteCanBeSet()
|
public function testCheckinTimeAndActionLogNoteCanBeSet()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete(
|
|
||||||
'checkin_at currently takes a date and applies a time which is not inline with what the web controller does.'
|
|
||||||
);
|
|
||||||
|
|
||||||
Event::fake();
|
Event::fake();
|
||||||
|
|
||||||
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||||
->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()), [
|
->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()), [
|
||||||
'checkin_at' => '2023-01-02 12:34:56',
|
// time is appended to the provided date in controller
|
||||||
|
'checkin_at' => '2023-01-02',
|
||||||
'note' => 'hi there',
|
'note' => 'hi there',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Event::assertDispatched(function (CheckoutableCheckedIn $event) {
|
Event::assertDispatched(function (CheckoutableCheckedIn $event) {
|
||||||
return $event->action_date === '2023-01-02 12:34:56' && $event->note === 'hi there';
|
return Carbon::parse('2023-01-02')->isSameDay(Carbon::parse($event->action_date))
|
||||||
|
&& $event->note === 'hi there';
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue