2019-11-27 23:43:21 +01:00
|
|
|
<?php
|
|
|
|
|
2023-02-03 20:41:59 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-11-27 23:43:21 +01:00
|
|
|
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Engelsystem\Helpers\Schedule\Day;
|
|
|
|
use Engelsystem\Helpers\Schedule\Room;
|
|
|
|
use Engelsystem\Test\Unit\TestCase;
|
|
|
|
|
|
|
|
class DayTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Day::__construct
|
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Day::getDate
|
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Day::getStart
|
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Day::getEnd
|
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Day::getIndex
|
2021-12-28 14:43:23 +01:00
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Day::getRooms
|
2019-11-27 23:43:21 +01:00
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function testCreate(): void
|
2019-11-27 23:43:21 +01:00
|
|
|
{
|
|
|
|
$day = new Day(
|
|
|
|
'2000-01-01',
|
|
|
|
new Carbon('2000-01-01T03:00:00+01:00'),
|
|
|
|
new Carbon('2000-01-02T05:59:00+00:00'),
|
|
|
|
1
|
|
|
|
);
|
|
|
|
$this->assertEquals('2000-01-01', $day->getDate());
|
|
|
|
$this->assertEquals('2000-01-01T03:00:00+01:00', $day->getStart()->format(Carbon::RFC3339));
|
|
|
|
$this->assertEquals('2000-01-02T05:59:00+00:00', $day->getEnd()->format(Carbon::RFC3339));
|
|
|
|
$this->assertEquals(1, $day->getIndex());
|
2021-12-28 14:43:23 +01:00
|
|
|
$this->assertEquals([], $day->getRooms());
|
2019-11-27 23:43:21 +01:00
|
|
|
|
|
|
|
$rooms = [
|
|
|
|
new Room('Foo'),
|
|
|
|
new Room('Bar'),
|
|
|
|
];
|
|
|
|
$day = new Day(
|
|
|
|
'2001-01-01',
|
|
|
|
new Carbon('2001-01-01T03:00:00+01:00'),
|
|
|
|
new Carbon('2001-01-02T05:59:00+00:00'),
|
|
|
|
1,
|
|
|
|
$rooms
|
|
|
|
);
|
2021-12-28 14:43:23 +01:00
|
|
|
$this->assertEquals($rooms, $day->getRooms());
|
2019-11-27 23:43:21 +01:00
|
|
|
}
|
|
|
|
}
|