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;
|
2023-12-17 23:42:23 +01:00
|
|
|
use Engelsystem\Helpers\Schedule\ConferenceTrack;
|
2019-11-27 23:43:21 +01:00
|
|
|
use Engelsystem\Helpers\Schedule\Event;
|
2023-12-17 23:42:23 +01:00
|
|
|
use Engelsystem\Helpers\Schedule\EventRecording;
|
2019-11-27 23:43:21 +01:00
|
|
|
use Engelsystem\Helpers\Schedule\Room;
|
2023-12-17 23:42:23 +01:00
|
|
|
use Engelsystem\Helpers\Uuid;
|
2019-11-27 23:43:21 +01:00
|
|
|
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
|
2023-12-17 23:42:23 +01:00
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Event::getFeedbackUrl
|
2019-11-27 23:43:21 +01:00
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
|
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Event::getEndDate
|
|
|
|
*/
|
2023-12-17 23:42:23 +01:00
|
|
|
public function testCreateDefault(): void
|
2019-11-27 23:43:21 +01:00
|
|
|
{
|
|
|
|
$room = new Room('Foo');
|
|
|
|
$date = new Carbon('2020-12-28T19:30:00+00:00');
|
2023-12-17 23:42:23 +01:00
|
|
|
$uuid = Uuid::uuid();
|
2019-11-27 23:43:21 +01:00
|
|
|
$event = new Event(
|
2023-12-17 23:42:23 +01:00
|
|
|
$uuid,
|
2019-11-27 23:43:21 +01:00
|
|
|
1,
|
|
|
|
$room,
|
|
|
|
'Some stuff',
|
|
|
|
'sub stuff',
|
|
|
|
'Talk',
|
|
|
|
$date,
|
|
|
|
'19:30:00',
|
|
|
|
'00:50',
|
|
|
|
'Doing stuff is hard, plz try again',
|
|
|
|
'1-some-stuff',
|
2023-12-17 23:42:23 +01:00
|
|
|
new ConferenceTrack('Security'),
|
2019-11-27 23:43:21 +01:00
|
|
|
);
|
|
|
|
|
2023-12-17 23:42:23 +01:00
|
|
|
$this->assertEquals($uuid, $event->getGuid());
|
2019-11-27 23:43:21 +01:00
|
|
|
$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());
|
2023-12-17 23:42:23 +01:00
|
|
|
$this->assertEquals('Security', $event->getTrack()->getName());
|
2019-11-27 23:43:21 +01:00
|
|
|
$this->assertNull($event->getLogo());
|
|
|
|
$this->assertEquals([], $event->getPersons());
|
|
|
|
$this->assertNull($event->getLanguage());
|
|
|
|
$this->assertNull($event->getDescription());
|
2023-12-17 23:42:23 +01:00
|
|
|
$this->assertNull($event->getRecording());
|
2019-11-27 23:43:21 +01:00
|
|
|
$this->assertEquals([], $event->getLinks());
|
|
|
|
$this->assertEquals([], $event->getAttachments());
|
|
|
|
$this->assertNull($event->getUrl());
|
|
|
|
$this->assertNull($event->getVideoDownloadUrl());
|
2023-12-17 23:42:23 +01:00
|
|
|
$this->assertNull($event->getFeedbackUrl());
|
2019-11-27 23:43:21 +01:00
|
|
|
$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
|
2019-11-30 01:15:39 +01:00
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Event::setTitle
|
2019-11-27 23:43:21 +01:00
|
|
|
* @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
|
2023-12-17 23:42:23 +01:00
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Event::getFeedbackUrl
|
2019-11-27 23:43:21 +01:00
|
|
|
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
|
|
|
|
*/
|
2023-12-17 23:42:23 +01:00
|
|
|
public function testCreate(): void
|
2019-11-27 23:43:21 +01:00
|
|
|
{
|
|
|
|
$persons = [1337 => 'Some Person'];
|
|
|
|
$links = ['https://foo.bar' => 'Foo Bar'];
|
|
|
|
$attachments = ['/files/foo.pdf' => 'Suspicious PDF'];
|
|
|
|
$event = new Event(
|
2023-12-17 23:42:23 +01:00
|
|
|
Uuid::uuid(),
|
2019-11-27 23:43:21 +01:00
|
|
|
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',
|
2023-12-17 23:42:23 +01:00
|
|
|
new ConferenceTrack('DevOps'),
|
2019-11-27 23:43:21 +01:00
|
|
|
'/foo/bar.png',
|
|
|
|
$persons,
|
|
|
|
'de',
|
|
|
|
'Foo bar is awesome! & That\'s why...',
|
2023-12-17 23:42:23 +01:00
|
|
|
new EventRecording('CC BY SA', false),
|
2019-11-27 23:43:21 +01:00
|
|
|
$links,
|
|
|
|
$attachments,
|
|
|
|
'https://foo.bar/2-lorem',
|
2023-12-17 23:42:23 +01:00
|
|
|
'https://videos.orem.ipsum/2-lorem.mp4',
|
|
|
|
'https://videos.orem.ipsum/2-lorem/feedback'
|
2019-11-27 23:43:21 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$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());
|
2023-12-17 23:42:23 +01:00
|
|
|
$this->assertNotNull($event->getRecording());
|
|
|
|
$this->assertEquals('CC BY SA', $event->getRecording()->getLicense());
|
2019-11-27 23:43:21 +01:00
|
|
|
$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());
|
2023-12-17 23:42:23 +01:00
|
|
|
$this->assertEquals('https://videos.orem.ipsum/2-lorem/feedback', $event->getFeedbackUrl());
|
2019-11-30 01:15:39 +01:00
|
|
|
|
|
|
|
$event->setTitle('Event title');
|
|
|
|
$this->assertEquals('Event title', $event->getTitle());
|
2019-11-27 23:43:21 +01:00
|
|
|
}
|
|
|
|
}
|