engelsystem/tests/Unit/Models/Shifts/ShiftEntryTest.php

40 lines
1.2 KiB
PHP
Raw Normal View History

2023-01-18 13:02:11 +01:00
<?php
namespace Engelsystem\Test\Unit\Models\Shifts;
use Engelsystem\Models\AngelType;
use Engelsystem\Models\Shifts\Shift;
use Engelsystem\Models\Shifts\ShiftEntry;
use Engelsystem\Models\User\User;
use Engelsystem\Test\Unit\Models\ModelTest;
class ShiftEntryTest extends ModelTest
{
/**
* @covers \Engelsystem\Models\Shifts\ShiftEntry::shift
* @covers \Engelsystem\Models\Shifts\ShiftEntry::angelType
*/
public function testShift(): void
{
/** @var Shift $shift */
$shift = Shift::factory()->create();
/** @var AngelType $angelType */
$angelType = AngelType::factory()->create();
/** @var User $user */
$user = User::factory()->create();
$model = new ShiftEntry();
$model->shift()->associate($shift);
$model->angelType()->associate($angelType);
$model->user()->associate($user);
$model->save();
$model = ShiftEntry::find(1);
$this->assertEquals($shift->id, $model->shift->id);
$this->assertEquals($angelType->id, $model->angelType->id);
$this->assertEquals($user->id, $model->user->id);
2023-01-29 02:12:40 +01:00
$this->assertArrayNotHasKey('freeloaded_comment', $model->toArray());
2023-01-18 13:02:11 +01:00
}
}