Schedule: Update to parse newer specification
This commit is contained in:
parent
b63eb44b39
commit
d8f8a4f67d
|
@ -9,6 +9,7 @@ use Engelsystem\Helpers\Carbon;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Engelsystem\Controllers\BaseController;
|
use Engelsystem\Controllers\BaseController;
|
||||||
use Engelsystem\Controllers\HasUserNotifications;
|
use Engelsystem\Controllers\HasUserNotifications;
|
||||||
|
use Engelsystem\Helpers\Schedule\ConferenceTrack;
|
||||||
use Engelsystem\Helpers\Schedule\Event;
|
use Engelsystem\Helpers\Schedule\Event;
|
||||||
use Engelsystem\Helpers\Schedule\Room;
|
use Engelsystem\Helpers\Schedule\Room;
|
||||||
use Engelsystem\Helpers\Schedule\Schedule;
|
use Engelsystem\Helpers\Schedule\Schedule;
|
||||||
|
@ -158,7 +159,7 @@ class ScheduleController extends BaseController
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
''
|
new ConferenceTrack('')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->deleteEvent($event, $schedule);
|
$this->deleteEvent($event, $schedule);
|
||||||
|
@ -571,7 +572,7 @@ class ScheduleController extends BaseController
|
||||||
$duration->format('%H:%I'),
|
$duration->format('%H:%I'),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
''
|
new ConferenceTrack('')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@ class Conference
|
||||||
{
|
{
|
||||||
use CalculatesTime;
|
use CalculatesTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ConferenceTrack[] $tracks
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected string $title,
|
protected string $title,
|
||||||
protected string $acronym,
|
protected string $acronym,
|
||||||
|
@ -15,7 +18,12 @@ class Conference
|
||||||
protected ?string $end = null,
|
protected ?string $end = null,
|
||||||
protected ?int $days = null,
|
protected ?int $days = null,
|
||||||
protected ?string $timeslotDuration = null,
|
protected ?string $timeslotDuration = null,
|
||||||
protected ?string $baseUrl = null
|
protected ?string $baseUrl = null,
|
||||||
|
protected ?string $logo = null,
|
||||||
|
protected ?string $url = null,
|
||||||
|
protected ?string $timeZoneName = null,
|
||||||
|
protected ?ConferenceColor $color = null,
|
||||||
|
protected array $tracks = [],
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,4 +71,32 @@ class Conference
|
||||||
{
|
{
|
||||||
return $this->baseUrl;
|
return $this->baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLogo(): ?string
|
||||||
|
{
|
||||||
|
return $this->logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUrl(): ?string
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTimeZoneName(): ?string
|
||||||
|
{
|
||||||
|
return $this->timeZoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColor(): ?ConferenceColor
|
||||||
|
{
|
||||||
|
return $this->color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ConferenceTrack[]
|
||||||
|
*/
|
||||||
|
public function getTracks(): array
|
||||||
|
{
|
||||||
|
return $this->tracks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Helpers\Schedule;
|
||||||
|
|
||||||
|
class ConferenceColor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $others type -> color
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
protected ?string $primary = null,
|
||||||
|
protected ?string $background = null,
|
||||||
|
protected array $others = []
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrimary(): ?string
|
||||||
|
{
|
||||||
|
return $this->primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBackground(): ?string
|
||||||
|
{
|
||||||
|
return $this->background;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOthers(): array
|
||||||
|
{
|
||||||
|
return $this->others;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Helpers\Schedule;
|
||||||
|
|
||||||
|
class ConferenceTrack
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
protected string $name,
|
||||||
|
protected ?string $color = null,
|
||||||
|
protected ?string $slug = null,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColor(): ?string
|
||||||
|
{
|
||||||
|
return $this->color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSlug(): ?string
|
||||||
|
{
|
||||||
|
return $this->slug;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,11 +19,11 @@ class Event
|
||||||
* @param string $start time (hh:mm:ss || hh:mm)
|
* @param string $start time (hh:mm:ss || hh:mm)
|
||||||
* @param string $duration (h?h:mm:ss || h?h:mm)
|
* @param string $duration (h?h:mm:ss || h?h:mm)
|
||||||
* @param string $slug globally unique
|
* @param string $slug globally unique
|
||||||
* @param string[] $persons id => name
|
* @param array<int, string> $persons id => name
|
||||||
* @param string|null $language two-letter code
|
* @param string|null $language two-letter code
|
||||||
* @param string|null $recording license (and opt out in XML, null if not recorded, empty if no license defined)/
|
* @param EventRecording|null $recording license, links, url and opt out from XML, null if not defined
|
||||||
* @param array $links href => title
|
* @param array<string, string> $links href => title
|
||||||
* @param array $attachments href => title
|
* @param array<string, string> $attachments href => title
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected string $guid,
|
protected string $guid,
|
||||||
|
@ -37,16 +37,17 @@ class Event
|
||||||
protected string $duration,
|
protected string $duration,
|
||||||
protected string $abstract,
|
protected string $abstract,
|
||||||
protected string $slug,
|
protected string $slug,
|
||||||
protected string $track,
|
protected ConferenceTrack $track,
|
||||||
protected ?string $logo = null,
|
protected ?string $logo = null,
|
||||||
protected array $persons = [],
|
protected array $persons = [],
|
||||||
protected ?string $language = null,
|
protected ?string $language = null,
|
||||||
protected ?string $description = null,
|
protected ?string $description = null,
|
||||||
protected ?string $recording = '',
|
protected ?EventRecording $recording = null,
|
||||||
protected array $links = [],
|
protected array $links = [],
|
||||||
protected array $attachments = [],
|
protected array $attachments = [],
|
||||||
protected ?string $url = null,
|
protected ?string $url = null,
|
||||||
protected ?string $videoDownloadUrl = null
|
protected ?string $videoDownloadUrl = null,
|
||||||
|
protected ?string $feedbackUrl = null,
|
||||||
) {
|
) {
|
||||||
$this->endDate = $this->date
|
$this->endDate = $this->date
|
||||||
->copy()
|
->copy()
|
||||||
|
@ -118,7 +119,7 @@ class Event
|
||||||
return $this->slug;
|
return $this->slug;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTrack(): string
|
public function getTrack(): ConferenceTrack
|
||||||
{
|
{
|
||||||
return $this->track;
|
return $this->track;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +130,7 @@ class Event
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public function getPersons(): array
|
public function getPersons(): array
|
||||||
{
|
{
|
||||||
|
@ -146,7 +147,7 @@ class Event
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRecording(): ?string
|
public function getRecording(): ?EventRecording
|
||||||
{
|
{
|
||||||
return $this->recording;
|
return $this->recording;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +167,11 @@ class Event
|
||||||
return $this->url;
|
return $this->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFeedbackUrl(): ?string
|
||||||
|
{
|
||||||
|
return $this->feedbackUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public function getVideoDownloadUrl(): ?string
|
public function getVideoDownloadUrl(): ?string
|
||||||
{
|
{
|
||||||
return $this->videoDownloadUrl;
|
return $this->videoDownloadUrl;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Helpers\Schedule;
|
||||||
|
|
||||||
|
class EventRecording
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
protected string $license,
|
||||||
|
protected bool $optOut,
|
||||||
|
protected ?string $url = null,
|
||||||
|
protected ?string $link = null
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLicense(): string
|
||||||
|
{
|
||||||
|
return $this->license;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isOptOut(): bool
|
||||||
|
{
|
||||||
|
return $this->optOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUrl(): ?string
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLink(): ?string
|
||||||
|
{
|
||||||
|
return $this->link;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,9 +8,11 @@ class Room
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param Event[] $events
|
* @param Event[] $events
|
||||||
|
* @param ?string $guid Globally unique id
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected string $name,
|
protected string $name,
|
||||||
|
protected ?string $guid = null,
|
||||||
protected array $events = []
|
protected array $events = []
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
@ -35,4 +37,9 @@ class Room
|
||||||
{
|
{
|
||||||
$this->events = $events;
|
$this->events = $events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGuid(): ?string
|
||||||
|
{
|
||||||
|
return $this->guid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ class Schedule
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected string $version,
|
protected string $version,
|
||||||
protected Conference $conference,
|
protected Conference $conference,
|
||||||
protected array $days
|
protected array $days,
|
||||||
|
protected ?ScheduleGenerator $generator = null,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,4 +83,9 @@ class Schedule
|
||||||
|
|
||||||
return $end;
|
return $end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGenerator(): ?ScheduleGenerator
|
||||||
|
{
|
||||||
|
return $this->generator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Helpers\Schedule;
|
||||||
|
|
||||||
|
class ScheduleGenerator
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
protected ?string $name = null,
|
||||||
|
protected ?string $version = null,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): ?string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVersion(): ?string
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,6 +35,10 @@ class XmlParser
|
||||||
protected function parseXml(): void
|
protected function parseXml(): void
|
||||||
{
|
{
|
||||||
$version = $this->getFirstXpathContent('version');
|
$version = $this->getFirstXpathContent('version');
|
||||||
|
$generator = $this->parseGenerator($this->scheduleXML);
|
||||||
|
$color = $this->parseConferenceColor($this->scheduleXML);
|
||||||
|
$tracks = $this->parseTracks($this->scheduleXML);
|
||||||
|
|
||||||
$conference = new Conference(
|
$conference = new Conference(
|
||||||
$this->getFirstXpathContent('conference/title'),
|
$this->getFirstXpathContent('conference/title'),
|
||||||
$this->getFirstXpathContent('conference/acronym'),
|
$this->getFirstXpathContent('conference/acronym'),
|
||||||
|
@ -42,28 +46,36 @@ class XmlParser
|
||||||
$this->getFirstXpathContent('conference/end'),
|
$this->getFirstXpathContent('conference/end'),
|
||||||
(int) $this->getFirstXpathContent('conference/days'),
|
(int) $this->getFirstXpathContent('conference/days'),
|
||||||
$this->getFirstXpathContent('conference/timeslot_duration'),
|
$this->getFirstXpathContent('conference/timeslot_duration'),
|
||||||
$this->getFirstXpathContent('conference/base_url')
|
$this->getFirstXpathContent('conference/base_url'),
|
||||||
|
$this->getFirstXpathContent('conference/logo'),
|
||||||
|
$this->getFirstXpathContent('conference/url'),
|
||||||
|
$this->getFirstXpathContent('conference/time_zone_name'),
|
||||||
|
$color,
|
||||||
|
$tracks,
|
||||||
);
|
);
|
||||||
$days = [];
|
|
||||||
|
|
||||||
|
$days = [];
|
||||||
foreach ($this->scheduleXML->xpath('day') as $day) {
|
foreach ($this->scheduleXML->xpath('day') as $day) {
|
||||||
$rooms = [];
|
$rooms = [];
|
||||||
|
|
||||||
foreach ($day->xpath('room') as $roomElement) {
|
foreach ($day->xpath('room') as $roomElement) {
|
||||||
|
$guid = (string) $roomElement->attributes()['guid'];
|
||||||
$room = new Room(
|
$room = new Room(
|
||||||
(string) $roomElement->attributes()['name']
|
(string) $roomElement->attributes()['name'],
|
||||||
|
!empty($guid) ? $guid : null
|
||||||
);
|
);
|
||||||
|
|
||||||
$events = $this->parseEvents($roomElement->xpath('event'), $room);
|
$events = $this->parseEvents($roomElement->xpath('event'), $room, $tracks);
|
||||||
$room->setEvents($events);
|
$room->setEvents($events);
|
||||||
$rooms[] = $room;
|
$rooms[] = $room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = $day->attributes();
|
||||||
$days[] = new Day(
|
$days[] = new Day(
|
||||||
(string) $day->attributes()['date'],
|
(string) $data['date'],
|
||||||
new Carbon($day->attributes()['start']),
|
new Carbon($data['start']),
|
||||||
new Carbon($day->attributes()['end']),
|
new Carbon($data['end']),
|
||||||
(int) $day->attributes()['index'],
|
(int) $data['index'],
|
||||||
$rooms
|
$rooms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -71,14 +83,68 @@ class XmlParser
|
||||||
$this->schedule = new Schedule(
|
$this->schedule = new Schedule(
|
||||||
$version,
|
$version,
|
||||||
$conference,
|
$conference,
|
||||||
$days
|
$days,
|
||||||
|
$generator
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function parseGenerator(SimpleXMLElement $scheduleXML): ?ScheduleGenerator
|
||||||
|
{
|
||||||
|
$generatorData = $scheduleXML->xpath('generator');
|
||||||
|
if (!isset($generatorData[0])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $generatorData[0]->attributes();
|
||||||
|
return new ScheduleGenerator(
|
||||||
|
(string) $data['name'] ?? null,
|
||||||
|
(string) $data['version'] ?? null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function parseConferenceColor(SimpleXMLElement $scheduleXML): ?ConferenceColor
|
||||||
|
{
|
||||||
|
$conferenceColorData = $scheduleXML->xpath('conference/color');
|
||||||
|
if (!isset($conferenceColorData[0])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = collect($conferenceColorData[0]->attributes())->map(fn($value) => (string) $value);
|
||||||
|
$additionalData = $data->collect()->forget(['primary', 'background']);
|
||||||
|
return new ConferenceColor(
|
||||||
|
$data['primary'] ?? null,
|
||||||
|
$data['background'] ?? null,
|
||||||
|
$additionalData->isNotEmpty() ? $additionalData->toArray() : []
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SimpleXMLElement[] $eventElements
|
* @return ConferenceTrack[]
|
||||||
*/
|
*/
|
||||||
protected function parseEvents(array $eventElements, Room $room): array
|
protected function parseTracks(SimpleXMLElement $scheduleXML): array
|
||||||
|
{
|
||||||
|
$tracksData = $scheduleXML->xpath('conference/track');
|
||||||
|
if (!isset($tracksData[0])) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$tracks = [];
|
||||||
|
foreach ($tracksData as $trackData) {
|
||||||
|
$data = $trackData->attributes();
|
||||||
|
$tracks[] = new ConferenceTrack(
|
||||||
|
(string) $data['name'],
|
||||||
|
(string) $data['color'] ?? null,
|
||||||
|
(string) $data['slug'] ?? null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $tracks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SimpleXMLElement[] $eventElements
|
||||||
|
* @param ConferenceTrack[] $tracks
|
||||||
|
*/
|
||||||
|
protected function parseEvents(array $eventElements, Room $room, array $tracks): array
|
||||||
{
|
{
|
||||||
$events = [];
|
$events = [];
|
||||||
|
|
||||||
|
@ -87,11 +153,9 @@ class XmlParser
|
||||||
$links = $this->getListFromSequence($event, 'links', 'link', 'href');
|
$links = $this->getListFromSequence($event, 'links', 'link', 'href');
|
||||||
$attachments = $this->getListFromSequence($event, 'attachments', 'attachment', 'href');
|
$attachments = $this->getListFromSequence($event, 'attachments', 'attachment', 'href');
|
||||||
|
|
||||||
$recording = '';
|
$recording = $this->parseRecording($event);
|
||||||
$recordingElement = $event->xpath('recording');
|
$trackName = $this->getFirstXpathContent('track', $event);
|
||||||
if ($recordingElement && $this->getFirstXpathContent('optout', $recordingElement[0]) == 'false') {
|
$track = collect($tracks)->where('name', $trackName)->first() ?: new ConferenceTrack($trackName);
|
||||||
$recording = $this->getFirstXpathContent('license', $recordingElement[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$events[] = new Event(
|
$events[] = new Event(
|
||||||
(string) $event->attributes()['guid'],
|
(string) $event->attributes()['guid'],
|
||||||
|
@ -105,7 +169,7 @@ class XmlParser
|
||||||
$this->getFirstXpathContent('duration', $event),
|
$this->getFirstXpathContent('duration', $event),
|
||||||
$this->getFirstXpathContent('abstract', $event),
|
$this->getFirstXpathContent('abstract', $event),
|
||||||
$this->getFirstXpathContent('slug', $event),
|
$this->getFirstXpathContent('slug', $event),
|
||||||
$this->getFirstXpathContent('track', $event),
|
$track,
|
||||||
$this->getFirstXpathContent('logo', $event) ?: null,
|
$this->getFirstXpathContent('logo', $event) ?: null,
|
||||||
$persons,
|
$persons,
|
||||||
$this->getFirstXpathContent('language', $event) ?: null,
|
$this->getFirstXpathContent('language', $event) ?: null,
|
||||||
|
@ -114,13 +178,30 @@ class XmlParser
|
||||||
$links,
|
$links,
|
||||||
$attachments,
|
$attachments,
|
||||||
$this->getFirstXpathContent('url', $event) ?: null,
|
$this->getFirstXpathContent('url', $event) ?: null,
|
||||||
$this->getFirstXpathContent('video_download_url', $event) ?: null
|
$this->getFirstXpathContent('video_download_url', $event) ?: null,
|
||||||
|
$this->getFirstXpathContent('feedback_url', $event) ?: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $events;
|
return $events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function parseRecording(SimpleXMLElement $event): ?EventRecording
|
||||||
|
{
|
||||||
|
$recordingElement = $event->xpath('recording');
|
||||||
|
if (!isset($recordingElement[0])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$element = $recordingElement[0];
|
||||||
|
return new EventRecording(
|
||||||
|
$this->getFirstXpathContent('license', $element) ?: '',
|
||||||
|
$this->getFirstXpathContent('optout', $element) != 'false',
|
||||||
|
$this->getFirstXpathContent('url', $element) ?: null,
|
||||||
|
$this->getFirstXpathContent('link', $element) ?: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected function getFirstXpathContent(string $path, ?SimpleXMLElement $xml = null): string
|
protected function getFirstXpathContent(string $path, ?SimpleXMLElement $xml = null): string
|
||||||
{
|
{
|
||||||
$element = ($xml ?: $this->scheduleXML)->xpath($path);
|
$element = ($xml ?: $this->scheduleXML)->xpath($path);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xsi:noNamespaceSchemaLocation="https://c3voc.de/schedule/schema.xsd"
|
xsi:noNamespaceSchemaLocation="https://c3voc.de/schedule/schema.xsd"
|
||||||
>
|
>
|
||||||
<generator name="Engelsystem" version="1.2.3"/>
|
<generator name="Engelsystem" version="1.2.3"/>
|
||||||
<version>Some version string</version>
|
<version>some-version-string</version>
|
||||||
<conference>
|
<conference>
|
||||||
<title>Test Event</title>
|
<title>Test Event</title>
|
||||||
<acronym>test-3</acronym>
|
<acronym>test-3</acronym>
|
||||||
|
@ -13,7 +13,11 @@
|
||||||
<days>1</days>
|
<days>1</days>
|
||||||
<timeslot_duration>00:15</timeslot_duration>
|
<timeslot_duration>00:15</timeslot_duration>
|
||||||
<base_url>https://foo.bar/baz/schedule/</base_url>
|
<base_url>https://foo.bar/baz/schedule/</base_url>
|
||||||
|
<logo>https://foo.bar/baz.png</logo>
|
||||||
|
<url>https://foo.bar/</url>
|
||||||
<time_zone_name>Europe/Berlin</time_zone_name>
|
<time_zone_name>Europe/Berlin</time_zone_name>
|
||||||
|
<color primary="#abcdef" background="#aabbcc" customColor="#s011e7"/>
|
||||||
|
<track name="Testing" color="#dead55" slug="testing"/>
|
||||||
</conference>
|
</conference>
|
||||||
<day index='1' date='2042-01-01' start='2042-01-01T01:00:00+02:00' end='2042-01-01T22:59:00+02:00'>
|
<day index='1' date='2042-01-01' start='2042-01-01T01:00:00+02:00' end='2042-01-01T22:59:00+02:00'>
|
||||||
<room name='Rooming' guid="bf5f1132-82bd-4da2-bbe0-1abbf8daf4ab">
|
<room name='Rooming' guid="bf5f1132-82bd-4da2-bbe0-1abbf8daf4ab">
|
||||||
|
@ -38,15 +42,19 @@
|
||||||
<abstract>Foo bar is da best</abstract>
|
<abstract>Foo bar is da best</abstract>
|
||||||
<description>Any describing stuff?</description>
|
<description>Any describing stuff?</description>
|
||||||
<url>https://foo.bar/baz/schedule/ipsum</url>
|
<url>https://foo.bar/baz/schedule/ipsum</url>
|
||||||
|
<feedback_url>https://foo.bar/baz/schedule/ipsum#feedback</feedback_url>
|
||||||
<logo>https://lorem.ipsum/foo/bar.png</logo>
|
<logo>https://lorem.ipsum/foo/bar.png</logo>
|
||||||
<persons>
|
<persons>
|
||||||
<person id='1234'>Some Person</person>
|
<person id='1234'>Some Person</person>
|
||||||
|
<person id='1337'>Another Person</person>
|
||||||
</persons>
|
</persons>
|
||||||
<links>
|
<links>
|
||||||
<link href="https://foo.bar">Some Foo Bar</link>
|
<link href="https://foo.bar">Some Foo Bar</link>
|
||||||
|
<link href="https://example.com">Another example</link>
|
||||||
</links>
|
</links>
|
||||||
<attachments>
|
<attachments>
|
||||||
<attachment href="https://foo.bar/stuff.pdf">A PDF File</attachment>
|
<attachment href="https://foo.bar/stuff.pdf">A PDF File</attachment>
|
||||||
|
<attachment href="https://foo.bar/something.png">An image</attachment>
|
||||||
</attachments>
|
</attachments>
|
||||||
</event>
|
</event>
|
||||||
</room>
|
</room>
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
<end>2042-10-02</end>
|
<end>2042-10-02</end>
|
||||||
<days>2</days>
|
<days>2</days>
|
||||||
<timeslot_duration>00:30</timeslot_duration>
|
<timeslot_duration>00:30</timeslot_duration>
|
||||||
|
<track name="Talk"/>
|
||||||
|
<track name="Testing"/>
|
||||||
</conference>
|
</conference>
|
||||||
<day index='1' date='2042-10-01' start='2042-10-01T10:00:00+02:00' end='2042-10-01T22:59:00+02:00'>
|
<day index='1' date='2042-10-01' start='2042-10-01T10:00:00+02:00' end='2042-10-01T22:59:00+02:00'>
|
||||||
<room name='Example Room'>
|
<room name='Example Room'>
|
||||||
|
@ -22,7 +24,7 @@
|
||||||
<duration>01:30</duration>
|
<duration>01:30</duration>
|
||||||
<room>Example Room</room>
|
<room>Example Room</room>
|
||||||
<slug>first-1-event</slug>
|
<slug>first-1-event</slug>
|
||||||
<track>Testing</track>
|
<track>Foo</track>
|
||||||
<type>Talk</type>
|
<type>Talk</type>
|
||||||
<abstract>A minimal description</abstract>
|
<abstract>A minimal description</abstract>
|
||||||
<url>https://example.com/first-1-event</url>
|
<url>https://example.com/first-1-event</url>
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
||||||
|
|
||||||
|
use Engelsystem\Helpers\Schedule\ConferenceColor;
|
||||||
|
use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
|
class ConferenceColorTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::getPrimary
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::getBackground
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::getOthers
|
||||||
|
*/
|
||||||
|
public function testCreateDefaults(): void
|
||||||
|
{
|
||||||
|
$conferenceColor = new ConferenceColor();
|
||||||
|
|
||||||
|
$this->assertNull($conferenceColor->getPrimary());
|
||||||
|
$this->assertNull($conferenceColor->getBackground());
|
||||||
|
$this->assertEmpty($conferenceColor->getOthers());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::getPrimary
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::getBackground
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceColor::getOthers
|
||||||
|
*/
|
||||||
|
public function testCreate(): void
|
||||||
|
{
|
||||||
|
$conferenceColor = new ConferenceColor(
|
||||||
|
'#abcdef',
|
||||||
|
'#aabbcc',
|
||||||
|
[
|
||||||
|
'tertiary' => '#133742',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals('#abcdef', $conferenceColor->getPrimary());
|
||||||
|
$this->assertEquals('#aabbcc', $conferenceColor->getBackground());
|
||||||
|
$this->assertArrayHasKey('tertiary', $conferenceColor->getOthers());
|
||||||
|
$this->assertEquals('#133742', $conferenceColor->getOthers()['tertiary']);
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||||
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
||||||
|
|
||||||
use Engelsystem\Helpers\Schedule\Conference;
|
use Engelsystem\Helpers\Schedule\Conference;
|
||||||
|
use Engelsystem\Helpers\Schedule\ConferenceColor;
|
||||||
|
use Engelsystem\Helpers\Schedule\ConferenceTrack;
|
||||||
use Engelsystem\Test\Unit\TestCase;
|
use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
class ConferenceTest extends TestCase
|
class ConferenceTest extends TestCase
|
||||||
|
@ -19,8 +21,13 @@ class ConferenceTest extends TestCase
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeslotDuration
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeslotDuration
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeslotDurationSeconds
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeslotDurationSeconds
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Conference::getBaseUrl
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getBaseUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getLogo
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeZoneName
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getColor
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTracks
|
||||||
*/
|
*/
|
||||||
public function testCreate(): void
|
public function testCreateDefault(): void
|
||||||
{
|
{
|
||||||
$conference = new Conference('Doing stuff', 'DS');
|
$conference = new Conference('Doing stuff', 'DS');
|
||||||
$this->assertEquals('Doing stuff', $conference->getTitle());
|
$this->assertEquals('Doing stuff', $conference->getTitle());
|
||||||
|
@ -31,7 +38,31 @@ class ConferenceTest extends TestCase
|
||||||
$this->assertNull($conference->getTimeslotDuration());
|
$this->assertNull($conference->getTimeslotDuration());
|
||||||
$this->assertNull($conference->getTimeslotDurationSeconds());
|
$this->assertNull($conference->getTimeslotDurationSeconds());
|
||||||
$this->assertNull($conference->getBaseUrl());
|
$this->assertNull($conference->getBaseUrl());
|
||||||
|
$this->assertNull($conference->getLogo());
|
||||||
|
$this->assertNull($conference->getUrl());
|
||||||
|
$this->assertNull($conference->getTimeZoneName());
|
||||||
|
$this->assertNull($conference->getColor());
|
||||||
|
$this->assertEmpty($conference->getTracks());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTitle
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getAcronym
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getStart
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getEnd
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getDays
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeslotDuration
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeslotDurationSeconds
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getBaseUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getLogo
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTimeZoneName
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getColor
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Conference::getTracks
|
||||||
|
*/
|
||||||
|
public function testCreate(): void
|
||||||
|
{
|
||||||
$conference = new Conference(
|
$conference = new Conference(
|
||||||
'Doing stuff',
|
'Doing stuff',
|
||||||
'DS',
|
'DS',
|
||||||
|
@ -39,13 +70,27 @@ class ConferenceTest extends TestCase
|
||||||
'2042-01-10',
|
'2042-01-10',
|
||||||
10,
|
10,
|
||||||
'00:10',
|
'00:10',
|
||||||
'https://foo.bar/schedule'
|
'https://foo.bar/schedule',
|
||||||
|
'https://foo.bar/logo.png',
|
||||||
|
'https://foo.bar',
|
||||||
|
'Europe/Berlin',
|
||||||
|
new ConferenceColor('#ffffff'),
|
||||||
|
[new ConferenceTrack('Test')]
|
||||||
);
|
);
|
||||||
|
$this->assertEquals('Doing stuff', $conference->getTitle());
|
||||||
|
$this->assertEquals('DS', $conference->getAcronym());
|
||||||
$this->assertEquals('2042-01-01', $conference->getStart());
|
$this->assertEquals('2042-01-01', $conference->getStart());
|
||||||
$this->assertEquals('2042-01-10', $conference->getEnd());
|
$this->assertEquals('2042-01-10', $conference->getEnd());
|
||||||
$this->assertEquals(10, $conference->getDays());
|
$this->assertEquals(10, $conference->getDays());
|
||||||
$this->assertEquals('00:10', $conference->getTimeslotDuration());
|
$this->assertEquals('00:10', $conference->getTimeslotDuration());
|
||||||
$this->assertEquals(60 * 10, $conference->getTimeslotDurationSeconds());
|
$this->assertEquals(60 * 10, $conference->getTimeslotDurationSeconds());
|
||||||
$this->assertEquals('https://foo.bar/schedule', $conference->getBaseUrl());
|
$this->assertEquals('https://foo.bar/schedule', $conference->getBaseUrl());
|
||||||
|
$this->assertEquals('https://foo.bar/logo.png', $conference->getLogo());
|
||||||
|
$this->assertEquals('https://foo.bar', $conference->getUrl());
|
||||||
|
$this->assertEquals('Europe/Berlin', $conference->getTimeZoneName());
|
||||||
|
$this->assertNotNull($conference->getColor());
|
||||||
|
$this->assertEquals('#ffffff', $conference->getColor()->getPrimary());
|
||||||
|
$this->assertNotNull($conference->getTracks());
|
||||||
|
$this->assertEquals('Test', $conference->getTracks()[0]->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
||||||
|
|
||||||
|
use Engelsystem\Helpers\Schedule\ConferenceTrack;
|
||||||
|
use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
|
class ConferenceTrackTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::getName
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::getColor
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::getSlug
|
||||||
|
*/
|
||||||
|
public function testCreateDefaults(): void
|
||||||
|
{
|
||||||
|
$conferenceColor = new ConferenceTrack('Tracking');
|
||||||
|
|
||||||
|
$this->assertEquals('Tracking', $conferenceColor->getName());
|
||||||
|
$this->assertNull($conferenceColor->getColor());
|
||||||
|
$this->assertNull($conferenceColor->getSlug());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::getName
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::getColor
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ConferenceTrack::getSlug
|
||||||
|
*/
|
||||||
|
public function testCreate(): void
|
||||||
|
{
|
||||||
|
$conferenceColor = new ConferenceTrack(
|
||||||
|
'Testing',
|
||||||
|
'#abcdef',
|
||||||
|
'testing'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals('Testing', $conferenceColor->getName());
|
||||||
|
$this->assertEquals('#abcdef', $conferenceColor->getColor());
|
||||||
|
$this->assertEquals('testing', $conferenceColor->getSlug());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
||||||
|
|
||||||
|
use Engelsystem\Helpers\Schedule\EventRecording;
|
||||||
|
use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
|
class EventRecordingTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::getLicense
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::isOptOut
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::getUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::getLink
|
||||||
|
*/
|
||||||
|
public function testCreateDefaults(): void
|
||||||
|
{
|
||||||
|
$eventRecording = new EventRecording(
|
||||||
|
'WTFPL',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals('WTFPL', $eventRecording->getLicense());
|
||||||
|
$this->assertTrue($eventRecording->isOptOut());
|
||||||
|
$this->assertNull($eventRecording->getUrl());
|
||||||
|
$this->assertNull($eventRecording->getLink());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::getLicense
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::isOptOut
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::getUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\EventRecording::getLink
|
||||||
|
*/
|
||||||
|
public function testCreate(): void
|
||||||
|
{
|
||||||
|
$eventRecording = new EventRecording(
|
||||||
|
'BeerWare',
|
||||||
|
false,
|
||||||
|
'https://example.com/recording',
|
||||||
|
'https://exampple.com/license'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals('BeerWare', $eventRecording->getLicense());
|
||||||
|
$this->assertFalse($eventRecording->isOptOut());
|
||||||
|
$this->assertEquals('https://example.com/recording', $eventRecording->getUrl());
|
||||||
|
$this->assertEquals('https://exampple.com/license', $eventRecording->getLink());
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,8 +5,11 @@ declare(strict_types=1);
|
||||||
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Engelsystem\Helpers\Schedule\ConferenceTrack;
|
||||||
use Engelsystem\Helpers\Schedule\Event;
|
use Engelsystem\Helpers\Schedule\Event;
|
||||||
|
use Engelsystem\Helpers\Schedule\EventRecording;
|
||||||
use Engelsystem\Helpers\Schedule\Room;
|
use Engelsystem\Helpers\Schedule\Room;
|
||||||
|
use Engelsystem\Helpers\Uuid;
|
||||||
use Engelsystem\Test\Unit\TestCase;
|
use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
class EventTest extends TestCase
|
class EventTest extends TestCase
|
||||||
|
@ -34,15 +37,17 @@ class EventTest extends TestCase
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getLinks
|
* @covers \Engelsystem\Helpers\Schedule\Event::getLinks
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getAttachments
|
* @covers \Engelsystem\Helpers\Schedule\Event::getAttachments
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getUrl
|
* @covers \Engelsystem\Helpers\Schedule\Event::getUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Event::getFeedbackUrl
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
|
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getEndDate
|
* @covers \Engelsystem\Helpers\Schedule\Event::getEndDate
|
||||||
*/
|
*/
|
||||||
public function testCreate(): void
|
public function testCreateDefault(): void
|
||||||
{
|
{
|
||||||
$room = new Room('Foo');
|
$room = new Room('Foo');
|
||||||
$date = new Carbon('2020-12-28T19:30:00+00:00');
|
$date = new Carbon('2020-12-28T19:30:00+00:00');
|
||||||
|
$uuid = Uuid::uuid();
|
||||||
$event = new Event(
|
$event = new Event(
|
||||||
'0-1-2-3',
|
$uuid,
|
||||||
1,
|
1,
|
||||||
$room,
|
$room,
|
||||||
'Some stuff',
|
'Some stuff',
|
||||||
|
@ -53,10 +58,10 @@ class EventTest extends TestCase
|
||||||
'00:50',
|
'00:50',
|
||||||
'Doing stuff is hard, plz try again',
|
'Doing stuff is hard, plz try again',
|
||||||
'1-some-stuff',
|
'1-some-stuff',
|
||||||
'Security'
|
new ConferenceTrack('Security'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('0-1-2-3', $event->getGuid());
|
$this->assertEquals($uuid, $event->getGuid());
|
||||||
$this->assertEquals(1, $event->getId());
|
$this->assertEquals(1, $event->getId());
|
||||||
$this->assertEquals($room, $event->getRoom());
|
$this->assertEquals($room, $event->getRoom());
|
||||||
$this->assertEquals('Some stuff', $event->getTitle());
|
$this->assertEquals('Some stuff', $event->getTitle());
|
||||||
|
@ -67,16 +72,17 @@ class EventTest extends TestCase
|
||||||
$this->assertEquals('00:50', $event->getDuration());
|
$this->assertEquals('00:50', $event->getDuration());
|
||||||
$this->assertEquals('Doing stuff is hard, plz try again', $event->getAbstract());
|
$this->assertEquals('Doing stuff is hard, plz try again', $event->getAbstract());
|
||||||
$this->assertEquals('1-some-stuff', $event->getSlug());
|
$this->assertEquals('1-some-stuff', $event->getSlug());
|
||||||
$this->assertEquals('Security', $event->getTrack());
|
$this->assertEquals('Security', $event->getTrack()->getName());
|
||||||
$this->assertNull($event->getLogo());
|
$this->assertNull($event->getLogo());
|
||||||
$this->assertEquals([], $event->getPersons());
|
$this->assertEquals([], $event->getPersons());
|
||||||
$this->assertNull($event->getLanguage());
|
$this->assertNull($event->getLanguage());
|
||||||
$this->assertNull($event->getDescription());
|
$this->assertNull($event->getDescription());
|
||||||
$this->assertEquals('', $event->getRecording());
|
$this->assertNull($event->getRecording());
|
||||||
$this->assertEquals([], $event->getLinks());
|
$this->assertEquals([], $event->getLinks());
|
||||||
$this->assertEquals([], $event->getAttachments());
|
$this->assertEquals([], $event->getAttachments());
|
||||||
$this->assertNull($event->getUrl());
|
$this->assertNull($event->getUrl());
|
||||||
$this->assertNull($event->getVideoDownloadUrl());
|
$this->assertNull($event->getVideoDownloadUrl());
|
||||||
|
$this->assertNull($event->getFeedbackUrl());
|
||||||
$this->assertEquals('2020-12-28T20:20:00+00:00', $event->getEndDate()->format(Carbon::RFC3339));
|
$this->assertEquals('2020-12-28T20:20:00+00:00', $event->getEndDate()->format(Carbon::RFC3339));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,15 +110,16 @@ class EventTest extends TestCase
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getLinks
|
* @covers \Engelsystem\Helpers\Schedule\Event::getLinks
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getAttachments
|
* @covers \Engelsystem\Helpers\Schedule\Event::getAttachments
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getUrl
|
* @covers \Engelsystem\Helpers\Schedule\Event::getUrl
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Event::getFeedbackUrl
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
|
* @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl
|
||||||
*/
|
*/
|
||||||
public function testCreateNotDefault(): void
|
public function testCreate(): void
|
||||||
{
|
{
|
||||||
$persons = [1337 => 'Some Person'];
|
$persons = [1337 => 'Some Person'];
|
||||||
$links = ['https://foo.bar' => 'Foo Bar'];
|
$links = ['https://foo.bar' => 'Foo Bar'];
|
||||||
$attachments = ['/files/foo.pdf' => 'Suspicious PDF'];
|
$attachments = ['/files/foo.pdf' => 'Suspicious PDF'];
|
||||||
$event = new Event(
|
$event = new Event(
|
||||||
'3-2-1-0',
|
Uuid::uuid(),
|
||||||
2,
|
2,
|
||||||
new Room('Bar'),
|
new Room('Bar'),
|
||||||
'Lorem',
|
'Lorem',
|
||||||
|
@ -123,27 +130,30 @@ class EventTest extends TestCase
|
||||||
'00:30',
|
'00:30',
|
||||||
'Lorem ipsum dolor sit amet',
|
'Lorem ipsum dolor sit amet',
|
||||||
'2-lorem',
|
'2-lorem',
|
||||||
'DevOps',
|
new ConferenceTrack('DevOps'),
|
||||||
'/foo/bar.png',
|
'/foo/bar.png',
|
||||||
$persons,
|
$persons,
|
||||||
'de',
|
'de',
|
||||||
'Foo bar is awesome! & That\'s why...',
|
'Foo bar is awesome! & That\'s why...',
|
||||||
'CC BY SA',
|
new EventRecording('CC BY SA', false),
|
||||||
$links,
|
$links,
|
||||||
$attachments,
|
$attachments,
|
||||||
'https://foo.bar/2-lorem',
|
'https://foo.bar/2-lorem',
|
||||||
'https://videos.orem.ipsum/2-lorem.mp4'
|
'https://videos.orem.ipsum/2-lorem.mp4',
|
||||||
|
'https://videos.orem.ipsum/2-lorem/feedback'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('/foo/bar.png', $event->getLogo());
|
$this->assertEquals('/foo/bar.png', $event->getLogo());
|
||||||
$this->assertEquals($persons, $event->getPersons());
|
$this->assertEquals($persons, $event->getPersons());
|
||||||
$this->assertEquals('de', $event->getLanguage());
|
$this->assertEquals('de', $event->getLanguage());
|
||||||
$this->assertEquals('Foo bar is awesome! & That\'s why...', $event->getDescription());
|
$this->assertEquals('Foo bar is awesome! & That\'s why...', $event->getDescription());
|
||||||
$this->assertEquals('CC BY SA', $event->getRecording());
|
$this->assertNotNull($event->getRecording());
|
||||||
|
$this->assertEquals('CC BY SA', $event->getRecording()->getLicense());
|
||||||
$this->assertEquals($links, $event->getLinks());
|
$this->assertEquals($links, $event->getLinks());
|
||||||
$this->assertEquals($attachments, $event->getAttachments());
|
$this->assertEquals($attachments, $event->getAttachments());
|
||||||
$this->assertEquals('https://foo.bar/2-lorem', $event->getUrl());
|
$this->assertEquals('https://foo.bar/2-lorem', $event->getUrl());
|
||||||
$this->assertEquals('https://videos.orem.ipsum/2-lorem.mp4', $event->getVideoDownloadUrl());
|
$this->assertEquals('https://videos.orem.ipsum/2-lorem.mp4', $event->getVideoDownloadUrl());
|
||||||
|
$this->assertEquals('https://videos.orem.ipsum/2-lorem/feedback', $event->getFeedbackUrl());
|
||||||
|
|
||||||
$event->setTitle('Event title');
|
$event->setTitle('Event title');
|
||||||
$this->assertEquals('Event title', $event->getTitle());
|
$this->assertEquals('Event title', $event->getTitle());
|
||||||
|
|
|
@ -15,18 +15,30 @@ class RoomTest extends TestCase
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Room::__construct
|
* @covers \Engelsystem\Helpers\Schedule\Room::__construct
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Room::getName
|
* @covers \Engelsystem\Helpers\Schedule\Room::getName
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Room::getEvents
|
* @covers \Engelsystem\Helpers\Schedule\Room::getEvents
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Room::setEvents
|
* @covers \Engelsystem\Helpers\Schedule\Room::getGuid
|
||||||
*/
|
*/
|
||||||
public function testCreate(): void
|
public function testCreateDefault(): void
|
||||||
{
|
{
|
||||||
$room = new Room('Test');
|
$room = new Room('Test');
|
||||||
$this->assertEquals('Test', $room->getName());
|
$this->assertEquals('Test', $room->getName());
|
||||||
$this->assertEquals([], $room->getEvents());
|
$this->assertEquals([], $room->getEvents());
|
||||||
|
$this->assertNull($room->getGuid());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Room::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Room::getName
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Room::getEvents
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Room::setEvents
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Room::getGuid
|
||||||
|
*/
|
||||||
|
public function testCreate(): void
|
||||||
|
{
|
||||||
|
$uuid = Uuid::uuid();
|
||||||
$events = [$this->createMock(Event::class), $this->createMock(Event::class)];
|
$events = [$this->createMock(Event::class), $this->createMock(Event::class)];
|
||||||
$events2 = [$this->createMock(Event::class)];
|
$events2 = [$this->createMock(Event::class)];
|
||||||
$room = new Room('Test2', $events);
|
$room = new Room('Test2', $uuid, $events);
|
||||||
$this->assertEquals($events, $room->getEvents());
|
$this->assertEquals($events, $room->getEvents());
|
||||||
|
$this->assertEquals($uuid, $room->getGuid());
|
||||||
|
|
||||||
$room->setEvents($events2);
|
$room->setEvents($events2);
|
||||||
$this->assertEquals($events2, $room->getEvents());
|
$this->assertEquals($events2, $room->getEvents());
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Engelsystem\Test\Unit\Helpers\Schedule;
|
||||||
|
|
||||||
|
use Engelsystem\Helpers\Schedule\ScheduleGenerator;
|
||||||
|
use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
|
class ScheduleGeneratorTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ScheduleGenerator::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ScheduleGenerator::getName
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ScheduleGenerator::getVersion
|
||||||
|
*/
|
||||||
|
public function testCreateDefaults(): void
|
||||||
|
{
|
||||||
|
$conferenceColor = new ScheduleGenerator();
|
||||||
|
|
||||||
|
$this->assertNull($conferenceColor->getName());
|
||||||
|
$this->assertNull($conferenceColor->getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ScheduleGenerator::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ScheduleGenerator::getName
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\ScheduleGenerator::getVersion
|
||||||
|
*/
|
||||||
|
public function testCreate(): void
|
||||||
|
{
|
||||||
|
$conferenceColor = new ScheduleGenerator('Engelsystem', '1.2.3');
|
||||||
|
|
||||||
|
$this->assertEquals('Engelsystem', $conferenceColor->getName());
|
||||||
|
$this->assertEquals('1.2.3', $conferenceColor->getVersion());
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ use Engelsystem\Helpers\Schedule\Conference;
|
||||||
use Engelsystem\Helpers\Schedule\Day;
|
use Engelsystem\Helpers\Schedule\Day;
|
||||||
use Engelsystem\Helpers\Schedule\Room;
|
use Engelsystem\Helpers\Schedule\Room;
|
||||||
use Engelsystem\Helpers\Schedule\Schedule;
|
use Engelsystem\Helpers\Schedule\Schedule;
|
||||||
|
use Engelsystem\Helpers\Schedule\ScheduleGenerator;
|
||||||
use Engelsystem\Test\Unit\HasDatabase;
|
use Engelsystem\Test\Unit\HasDatabase;
|
||||||
use Engelsystem\Test\Unit\TestCase;
|
use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ class ScheduleTest extends TestCase
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Schedule::getVersion
|
* @covers \Engelsystem\Helpers\Schedule\Schedule::getVersion
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Schedule::getConference
|
* @covers \Engelsystem\Helpers\Schedule\Schedule::getConference
|
||||||
* @covers \Engelsystem\Helpers\Schedule\Schedule::getDays
|
* @covers \Engelsystem\Helpers\Schedule\Schedule::getDays
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Schedule::getGenerator
|
||||||
*/
|
*/
|
||||||
public function testCreate(): void
|
public function testCreate(): void
|
||||||
{
|
{
|
||||||
|
@ -31,6 +33,7 @@ class ScheduleTest extends TestCase
|
||||||
$this->assertEquals('Foo\'ing stuff 1.0', $schedule->getVersion());
|
$this->assertEquals('Foo\'ing stuff 1.0', $schedule->getVersion());
|
||||||
$this->assertEquals($conference, $schedule->getConference());
|
$this->assertEquals($conference, $schedule->getConference());
|
||||||
$this->assertEquals($days, $schedule->getDays());
|
$this->assertEquals($days, $schedule->getDays());
|
||||||
|
$this->assertNull($schedule->getGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,6 +106,19 @@ class ScheduleTest extends TestCase
|
||||||
$this->assertNull($schedule->getEndDateTime());
|
$this->assertNull($schedule->getEndDateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Schedule::__construct
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\Schedule::getGenerator
|
||||||
|
*/
|
||||||
|
public function testGetGenerator(): void
|
||||||
|
{
|
||||||
|
$conference = new Conference('Foo Bar', 'FooB');
|
||||||
|
$generator = new ScheduleGenerator('test', '1337');
|
||||||
|
$schedule = new Schedule('1.0', $conference, [], $generator);
|
||||||
|
|
||||||
|
$this->assertEquals($generator, $schedule->getGenerator());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare test
|
* Prepare test
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,13 +16,18 @@ class XmlParserTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Helpers\Schedule\XmlParser::load
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::load
|
||||||
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseXml
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseXml
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseGenerator
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseConferenceColor
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseTracks
|
||||||
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseEvents
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseEvents
|
||||||
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::parseRecording
|
||||||
* @covers \Engelsystem\Helpers\Schedule\XmlParser::getFirstXpathContent
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::getFirstXpathContent
|
||||||
* @covers \Engelsystem\Helpers\Schedule\XmlParser::getListFromSequence
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::getListFromSequence
|
||||||
* @covers \Engelsystem\Helpers\Schedule\XmlParser::getSchedule
|
* @covers \Engelsystem\Helpers\Schedule\XmlParser::getSchedule
|
||||||
*/
|
*/
|
||||||
public function testLoad(): void
|
public function testLoad(): void
|
||||||
{
|
{
|
||||||
|
$dateTimeFormat = 'Y-m-d\TH:i:sP';
|
||||||
$parser = new XmlParser();
|
$parser = new XmlParser();
|
||||||
|
|
||||||
// Invalid XML
|
// Invalid XML
|
||||||
|
@ -38,28 +43,86 @@ class XmlParserTest extends TestCase
|
||||||
$this->assertTrue($parser->load(file_get_contents(__DIR__ . '/Assets/schedule-extended.xml')));
|
$this->assertTrue($parser->load(file_get_contents(__DIR__ . '/Assets/schedule-extended.xml')));
|
||||||
|
|
||||||
$schedule = $parser->getSchedule();
|
$schedule = $parser->getSchedule();
|
||||||
$this->assertEquals('Some version string', $schedule->getVersion());
|
|
||||||
$this->assertEquals('Test Event', $schedule->getConference()->getTitle());
|
|
||||||
|
|
||||||
/** @var Room $room */
|
$generator = $schedule->getGenerator();
|
||||||
$room = Arr::first($schedule->getRooms());
|
$this->assertNotNull($generator);
|
||||||
$this->assertEquals('Rooming', $room->getName());
|
$this->assertEquals('Engelsystem', $generator->getName());
|
||||||
|
$this->assertEquals('1.2.3', $generator->getVersion());
|
||||||
|
|
||||||
|
$this->assertEquals('some-version-string', $schedule->getVersion());
|
||||||
|
|
||||||
|
$conference = $schedule->getConference();
|
||||||
|
$this->assertEquals('Test Event', $conference->getTitle());
|
||||||
|
$this->assertEquals('test-3', $conference->getAcronym());
|
||||||
|
$this->assertEquals('2042-01-01T01:00:00+02:00', $conference->getStart());
|
||||||
|
$this->assertEquals('2042-01-01T22:59:00+02:00', $conference->getEnd());
|
||||||
|
$this->assertEquals(1, $conference->getDays());
|
||||||
|
$this->assertEquals('00:15', $conference->getTimeslotDuration());
|
||||||
|
$this->assertEquals('https://foo.bar/baz/schedule/', $conference->getBaseUrl());
|
||||||
|
$this->assertEquals('https://foo.bar/baz.png', $conference->getLogo());
|
||||||
|
$this->assertEquals('https://foo.bar/', $conference->getUrl());
|
||||||
|
$this->assertEquals('Europe/Berlin', $conference->getTimeZoneName());
|
||||||
|
$color = $conference->getColor();
|
||||||
|
$this->assertNotNull($color);
|
||||||
|
$this->assertEquals('#abcdef', $color->getPrimary());
|
||||||
|
$this->assertEquals('#aabbcc', $color->getBackground());
|
||||||
|
$this->assertEquals(['customColor' => '#s011e7'], $color->getOthers());
|
||||||
|
$tracks = $conference->getTracks();
|
||||||
|
$this->assertNotNull($tracks);
|
||||||
|
$this->assertEquals('Testing', $tracks[0]->getName());
|
||||||
|
$this->assertEquals('#dead55', $tracks[0]->getColor());
|
||||||
|
$this->assertEquals('testing', $tracks[0]->getSlug());
|
||||||
|
;
|
||||||
|
|
||||||
/** @var Day $day */
|
/** @var Day $day */
|
||||||
$day = Arr::first($schedule->getDays());
|
$day = Arr::first($schedule->getDays());
|
||||||
$this->assertEquals('2042-01-01', $day->getDate());
|
$this->assertEquals('2042-01-01', $day->getDate());
|
||||||
$this->assertEquals(1, $day->getIndex());
|
$this->assertEquals(1, $day->getIndex());
|
||||||
|
$this->assertEquals('2042-01-01T01:00:00+02:00', $day->getStart()->format($dateTimeFormat));
|
||||||
|
$this->assertEquals('2042-01-01T22:59:00+02:00', $day->getEnd()->format($dateTimeFormat));
|
||||||
|
|
||||||
|
/** @var Room $room */
|
||||||
|
$room = Arr::first($schedule->getRooms());
|
||||||
|
$this->assertEquals('Rooming', $room->getName());
|
||||||
|
$this->assertEquals('bf5f1132-82bd-4da2-bbe0-1abbf8daf4ab', $room->getGuid());
|
||||||
|
|
||||||
/** @var Room $room */
|
/** @var Room $room */
|
||||||
$room = Arr::first($day->getRooms());
|
$room = Arr::first($day->getRooms());
|
||||||
/** @var Event $event */
|
/** @var Event $event */
|
||||||
$event = Arr::first($room->getEvents());
|
$event = Arr::first($room->getEvents());
|
||||||
|
|
||||||
|
$this->assertEquals('e427cfa9-9ba1-4b14-a99f-bce83ffe5a1c', $event->getGuid());
|
||||||
|
$this->assertEquals('1337', $event->getId());
|
||||||
|
$this->assertEquals('2042-01-01T12:30:00+02:00', $event->getDate()->format($dateTimeFormat));
|
||||||
$this->assertEquals('Foo Bar Test', $event->getTitle());
|
$this->assertEquals('Foo Bar Test', $event->getTitle());
|
||||||
$this->assertEquals('WTFPL', $event->getRecording());
|
$this->assertEquals('Some sub', $event->getSubtitle());
|
||||||
$this->assertEquals('de', $event->getLanguage());
|
|
||||||
$this->assertEquals('12:30', $event->getStart());
|
$this->assertEquals('12:30', $event->getStart());
|
||||||
$this->assertEquals([1234 => 'Some Person'], $event->getPersons());
|
$this->assertEquals('00:30', $event->getDuration());
|
||||||
|
$this->assertEquals($room, $event->getRoom());
|
||||||
|
$this->assertEquals('some-3-test', $event->getSlug());
|
||||||
|
$recording = $event->getRecording();
|
||||||
|
$this->assertNotNull($recording);
|
||||||
|
$this->assertEquals('WTFPL', $recording->getLicense());
|
||||||
|
$this->assertFalse($recording->isOptOut());
|
||||||
|
$this->assertEquals('https://recorder.test/some-3-test/recorded', $recording->getUrl());
|
||||||
|
$this->assertEquals('https://recorder.test/some-3-test', $recording->getLink());
|
||||||
$this->assertEquals('https://foo.bar/baz/schedule/ipsum/recording.mp4', $event->getVideoDownloadUrl());
|
$this->assertEquals('https://foo.bar/baz/schedule/ipsum/recording.mp4', $event->getVideoDownloadUrl());
|
||||||
|
$this->assertEquals('Testing', $event->getTrack()->getName());
|
||||||
|
$this->assertEquals('Talk', $event->getType());
|
||||||
|
$this->assertEquals('de', $event->getLanguage());
|
||||||
|
$this->assertEquals('Foo bar is da best', $event->getAbstract());
|
||||||
|
$this->assertEquals('Any describing stuff?', $event->getDescription());
|
||||||
|
$this->assertEquals('https://foo.bar/baz/schedule/ipsum', $event->getUrl());
|
||||||
|
$this->assertEquals('https://foo.bar/baz/schedule/ipsum#feedback', $event->getFeedbackUrl());
|
||||||
|
$this->assertEquals('https://lorem.ipsum/foo/bar.png', $event->getLogo());
|
||||||
|
$this->assertEquals([1234 => 'Some Person', 1337 => 'Another Person'], $event->getPersons());
|
||||||
|
$this->assertEquals([
|
||||||
|
'https://foo.bar' => 'Some Foo Bar',
|
||||||
|
'https://example.com' => 'Another example',
|
||||||
|
], $event->getLinks());
|
||||||
|
$this->assertEquals([
|
||||||
|
'https://foo.bar/stuff.pdf' => 'A PDF File',
|
||||||
|
'https://foo.bar/something.png' => 'An image',
|
||||||
|
], $event->getAttachments());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue