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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
<?php
namespace Engelsystem\Test\Unit\Helpers\Schedule;
use Carbon\Carbon;
use Engelsystem\Helpers\Schedule\Event;
use Engelsystem\Helpers\Schedule\Room;
use Engelsystem\Test\Unit\TestCase;
class EventTest extends TestCase
{
/**
* @covers \Engelsystem\Helpers\Schedule\Event::__construct
* @covers \Engelsystem\Helpers\Schedule\Event::getGuid
* @covers \Engelsystem\Helpers\Schedule\Event::getId
* @covers \Engelsystem\Helpers\Schedule\Event::getRoom
* @covers \Engelsystem\Helpers\Schedule\Event::getTitle
* @covers \Engelsystem\Helpers\Schedule\Event::getSubtitle
* @covers \Engelsystem\Helpers\Schedule\Event::getType
* @covers \Engelsystem\Helpers\Schedule\Event::getDate
* @covers \Engelsystem\Helpers\Schedule\Event::getStart
* @covers \Engelsystem\Helpers\Schedule\Event::getDuration
* @covers \Engelsystem\Helpers\Schedule\Event::getDurationSeconds
* @covers \Engelsystem\Helpers\Schedule\Event::getAbstract
* @covers \Engelsystem\Helpers\Schedule\Event::getSlug
* @covers \Engelsystem\Helpers\Schedule\Event::getTrack
* @covers \Engelsystem\Helpers\Schedule\Event::getLogo
* @covers \Engelsystem\Helpers\Schedule\Event::getPersons
* @covers \Engelsystem\Helpers\Schedule\Event::getLanguage
* @covers \Engelsystem\Helpers\Schedule\Event::getDescription
* @covers \Engelsystem\Helpers\Schedule\Event::getRecording
* @covers \Engelsystem\Helpers\Schedule\Event::getLinks
* @covers \Engelsystem\Helpers\Schedule\Event::getAttachments
* @covers \Engelsystem\Helpers\Schedule\Event::getUrl
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
* @covers \Engelsystem\Helpers\Schedule\Event::getEndDate
*/
public function testCreate()
{
$room = new Room('Foo');
$date = new Carbon('2020-12-28T19:30:00+00:00');
$event = new Event(
'0-1-2-3',
1,
$room,
'Some stuff',
'sub stuff',
'Talk',
$date,
'19:30:00',
'00:50',
'Doing stuff is hard, plz try again',
'1-some-stuff',
'Security'
);
$this->assertEquals('0-1-2-3', $event->getGuid());
$this->assertEquals(1, $event->getId());
$this->assertEquals($room, $event->getRoom());
$this->assertEquals('Some stuff', $event->getTitle());
$this->assertEquals('sub stuff', $event->getSubtitle());
$this->assertEquals('Talk', $event->getType());
$this->assertEquals($date, $event->getDate());
$this->assertEquals('19:30:00', $event->getStart());
$this->assertEquals('00:50', $event->getDuration());
$this->assertEquals('Doing stuff is hard, plz try again', $event->getAbstract());
$this->assertEquals('1-some-stuff', $event->getSlug());
$this->assertEquals('Security', $event->getTrack());
$this->assertNull($event->getLogo());
$this->assertEquals([], $event->getPersons());
$this->assertNull($event->getLanguage());
$this->assertNull($event->getDescription());
$this->assertEquals('', $event->getRecording());
$this->assertEquals([], $event->getLinks());
$this->assertEquals([], $event->getAttachments());
$this->assertNull($event->getUrl());
$this->assertNull($event->getVideoDownloadUrl());
$this->assertEquals('2020-12-28T20:20:00+00:00', $event->getEndDate()->format(Carbon::RFC3339));
}
/**
* @covers \Engelsystem\Helpers\Schedule\Event::__construct
* @covers \Engelsystem\Helpers\Schedule\Event::getGuid
* @covers \Engelsystem\Helpers\Schedule\Event::getId
* @covers \Engelsystem\Helpers\Schedule\Event::getRoom
* @covers \Engelsystem\Helpers\Schedule\Event::getTitle
* @covers \Engelsystem\Helpers\Schedule\Event::setTitle
* @covers \Engelsystem\Helpers\Schedule\Event::getSubtitle
* @covers \Engelsystem\Helpers\Schedule\Event::getType
* @covers \Engelsystem\Helpers\Schedule\Event::getDate
* @covers \Engelsystem\Helpers\Schedule\Event::getStart
* @covers \Engelsystem\Helpers\Schedule\Event::getDuration
* @covers \Engelsystem\Helpers\Schedule\Event::getDurationSeconds
* @covers \Engelsystem\Helpers\Schedule\Event::getAbstract
* @covers \Engelsystem\Helpers\Schedule\Event::getSlug
* @covers \Engelsystem\Helpers\Schedule\Event::getTrack
* @covers \Engelsystem\Helpers\Schedule\Event::getLogo
* @covers \Engelsystem\Helpers\Schedule\Event::getPersons
* @covers \Engelsystem\Helpers\Schedule\Event::getLanguage
* @covers \Engelsystem\Helpers\Schedule\Event::getDescription
* @covers \Engelsystem\Helpers\Schedule\Event::getRecording
* @covers \Engelsystem\Helpers\Schedule\Event::getLinks
* @covers \Engelsystem\Helpers\Schedule\Event::getAttachments
* @covers \Engelsystem\Helpers\Schedule\Event::getUrl
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
*/
public function testCreateNotDefault()
{
$persons = [1337 => 'Some Person'];
$links = ['https://foo.bar' => 'Foo Bar'];
$attachments = ['/files/foo.pdf' => 'Suspicious PDF'];
$event = new Event(
'3-2-1-0',
2,
new Room('Bar'),
'Lorem',
'Ipsum',
'Workshop',
new Carbon('2021-01-01T00:00:00+00:00'),
'00:00:00',
'00:30',
'Lorem ipsum dolor sit amet',
'2-lorem',
'DevOps',
'/foo/bar.png',
$persons,
'de',
'Foo bar is awesome! & That\'s why...',
'CC BY SA',
$links,
$attachments,
'https://foo.bar/2-lorem',
'https://videos.orem.ipsum/2-lorem.mp4'
);
$this->assertEquals('/foo/bar.png', $event->getLogo());
$this->assertEquals($persons, $event->getPersons());
$this->assertEquals('de', $event->getLanguage());
$this->assertEquals('Foo bar is awesome! & That\'s why...', $event->getDescription());
$this->assertEquals('CC BY SA', $event->getRecording());
$this->assertEquals($links, $event->getLinks());
$this->assertEquals($attachments, $event->getAttachments());
$this->assertEquals('https://foo.bar/2-lorem', $event->getUrl());
$this->assertEquals('https://videos.orem.ipsum/2-lorem.mp4', $event->getVideoDownloadUrl());
$event->setTitle('Event title');
$this->assertEquals('Event title', $event->getTitle());
}
}
|