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

30 lines
957 B
PHP
Raw Normal View History

<?php
namespace Engelsystem\Test\Unit\Models\Shifts;
use Engelsystem\Models\Shifts\Schedule;
use Engelsystem\Models\Shifts\ScheduleShift;
2020-05-11 19:57:25 +02:00
use Engelsystem\Test\Unit\Models\ModelTest;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2020-05-11 19:57:25 +02:00
class ScheduleShiftTest extends ModelTest
{
/**
* @covers \Engelsystem\Models\Shifts\ScheduleShift::schedule
*/
public function testScheduleShifts()
{
$schedule = new Schedule(['url' => 'https://lorem.ipsum/schedule.xml']);
$schedule->save();
$scheduleShift = new ScheduleShift(['shift_id' => 1, 'guid' => 'a']);
$scheduleShift->schedule()->associate($schedule);
$scheduleShift->save();
/** @var ScheduleShift $scheduleShift */
$scheduleShift = (new ScheduleShift())->find(1);
$this->assertInstanceOf(BelongsTo::class, $scheduleShift->schedule());
$this->assertEquals($schedule->id, $scheduleShift->schedule->id);
}
}