summaryrefslogtreecommitdiff
path: root/tests/Unit/Helpers/Schedule/DayTest.php
blob: 6570418139190a6a8e5813cfd5241b658988221a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

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
     * @covers \Engelsystem\Helpers\Schedule\Day::getRoom
     */
    public function testCreate()
    {
        $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());
        $this->assertEquals([], $day->getRoom());

        $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
        );
        $this->assertEquals($rooms, $day->getRoom());
    }
}