summaryrefslogtreecommitdiff
path: root/includes/composer/vendor/om/icalparser/tests/missing.timezone.phpt
blob: 63eb6c20c470108ce80f20c2c26db0587fedbf47 (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
<?php

use om\IcalParser;
use Tester\Assert;
use function tests\test;

require_once __DIR__ . '/bootstrap.php';
date_default_timezone_set('Europe/Prague');

test('Time zone should remain empty', function () {
	$cal = new IcalParser();
	$cal->parseFile(__DIR__ . '/cal/missing-timezone.ics');

	Assert::null($cal->timezone);
});

test('Timezone should be same as current timezone', function () {
	$cal = new IcalParser();
	$cal->parseFile(__DIR__ . '/cal/missing-timezone.ics');
	$dtstart = $cal->getEvents()->reversed()->getIterator()->current()['DTSTART'];
	/** @var DateTime $dtstart */
	Assert::same('Europe/Prague', $dtstart->getTimezone()->getName());
	Assert::same('7.11.2022', $dtstart->format('j.n.Y'));
});