mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-25 01:56:10 +01:00
Fix broken timezone during import
This commit is contained in:
parent
031bbbcb88
commit
e1674b1472
10 changed files with 215 additions and 173 deletions
|
@ -126,16 +126,15 @@ class DatesFactory
|
|||
$end = new \DateTimeImmutable($date['end'], $timeZone);
|
||||
$until = new \DateTimeImmutable($date['repeatUntil'], $timeZone);
|
||||
|
||||
$nextDate = $start;
|
||||
while ($nextDate <= $until) {
|
||||
$dateToUse = $nextDate;
|
||||
$nextDate = $dateToUse->modify('+1 day');
|
||||
if ($dateToUse < $today) {
|
||||
$period = new \DatePeriod($start, new \DateInterval('P1D'), $until);
|
||||
foreach ($period as $day) {
|
||||
$day = $day->setTimezone($timeZone);
|
||||
if ($day < $today) {
|
||||
continue;
|
||||
}
|
||||
|
||||
yield $this->createDateFromStartAndEnd(
|
||||
$dateToUse,
|
||||
$day,
|
||||
$start,
|
||||
$end,
|
||||
$canceled
|
||||
|
@ -157,16 +156,18 @@ class DatesFactory
|
|||
$until = new \DateTimeImmutable($date['repeatUntil'], $timeZone);
|
||||
|
||||
foreach ($date['weekdays'] as $day) {
|
||||
$nextDate = $start->modify($day);
|
||||
while ($nextDate <= $until) {
|
||||
$dateToUse = $nextDate;
|
||||
$nextDate = $dateToUse->modify('+1 week');
|
||||
if ($dateToUse < $today) {
|
||||
$dateToUse = $start->modify($day);
|
||||
$dateToUse = $dateToUse->setTime((int) $start->format('H'), (int) $start->format('i'));
|
||||
|
||||
$period = new \DatePeriod($dateToUse, new \DateInterval('P1W'), $until);
|
||||
foreach ($period as $day) {
|
||||
$day = $day->setTimezone($timeZone);
|
||||
if ($day < $today) {
|
||||
continue;
|
||||
}
|
||||
|
||||
yield $this->createDateFromStartAndEnd(
|
||||
$dateToUse,
|
||||
$day,
|
||||
$start,
|
||||
$end,
|
||||
$canceled
|
||||
|
|
32
Documentation/Changelog/2.6.1.rst
Normal file
32
Documentation/Changelog/2.6.1.rst
Normal file
|
@ -0,0 +1,32 @@
|
|||
2.6.0
|
||||
=====
|
||||
|
||||
Breaking
|
||||
--------
|
||||
|
||||
Nothing
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
Nothing
|
||||
|
||||
Fixes
|
||||
-----
|
||||
|
||||
* Respect timezone for recurring events.
|
||||
Some events occur over multiple time zones (same time zone but summer and winter time).
|
||||
We ensure PHP creates those objects as expected so we do not use the current offset,
|
||||
but the one of that date.
|
||||
|
||||
* Tests won't work after a specific date, we ensure they will work all the time.
|
||||
|
||||
Tasks
|
||||
-----
|
||||
|
||||
Nothing
|
||||
|
||||
Deprecation
|
||||
-----------
|
||||
|
||||
Nothing
|
|
@ -11,5 +11,6 @@ plugin.tx_events {
|
|||
settings {
|
||||
sortByDate = start
|
||||
sortOrder = ASC
|
||||
start = 1660158000
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,32 +16,32 @@
|
|||
,"6","3","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","e-100350503","0",,"1","2",,"8","6",,"1",
|
||||
"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link",,,,,,,,,,
|
||||
,"1","2","0","0","0","0",-1,0,"0","0","0","1","4101372000","4101377400","no","0",,,,,,,,,,,
|
||||
,"2","2","0","0","0","0",-1,0,"0","0","0","2","4101112800","4101118200","no","0",,,,,,,,,,,
|
||||
,"3","2","0","0","0","0",-1,0,"0","0","0","2",4078717200,4078724400,"no","0",,,,,,,,,,,
|
||||
,"4","2","0","0","0","0",-1,0,"0","0","0","2",4078803600,4078810800,"no","0",,,,,,,,,,,
|
||||
,"5","2","0","0","0","0",-1,0,"0","0","0","2","4075020000","4075027200","no","0",,,,,,,,,,,
|
||||
,"6","2","0","0","0","0",-1,0,"0","0","0","3","4099831200","4099834800","no","0",,,,,,,,,,,
|
||||
,"7","2","0","0","0","0",-1,0,"0","0","0","3","4097728800","4097736000","no","0",,,,,,,,,,,
|
||||
,"8","2","0","0","0","0",-1,0,"0","0","0","3","4098333600","4098340800","no","0",,,,,,,,,,,
|
||||
,"9","2","0","0","0","0",-1,0,"0","0","0","3","4098938400","4098945600","no","0",,,,,,,,,,,
|
||||
,"10","2","0","0","0","0",-1,0,"0","0","0","3","4097815200","4097822400","no","0",,,,,,,,,,,
|
||||
,"11","2","0","0","0","0",-1,0,"0","0","0","3","4098420000","4098427200","no","0",,,,,,,,,,,
|
||||
,"12","2","0","0","0","0",-1,0,"0","0","0","3","4099024800","4099032000","no","0",,,,,,,,,,,
|
||||
,"13","2","0","0","0","0",-1,0,"0","0","0","3","4101645600","4101649200","no","0",,,,,,,,,,,
|
||||
,"14","3","0","0","0","0",-1,0,"0","0","0","4","4101372000","4101377400","no","0",,,,,,,,,,,
|
||||
,"15","3","0","0","0","0",-1,0,"0","0","0","5","4101112800","4101118200","no","0",,,,,,,,,,,
|
||||
,"16","3","0","0","0","0",-1,0,"0","0","0","5",4078717200,4078724400,"no","0",,,,,,,,,,,
|
||||
,"17","3","0","0","0","0",-1,0,"0","0","0","5",4078803600,4078810800,"no","0",,,,,,,,,,,
|
||||
,"18","3","0","0","0","0",-1,0,"0","0","0","5","4075020000","4075027200","no","0",,,,,,,,,,,
|
||||
,"19","3","0","0","0","0",-1,0,"0","0","0","6","4099831200","4099834800","no","0",,,,,,,,,,,
|
||||
,"20","3","0","0","0","0",-1,0,"0","0","0","6","4097728800","4097736000","no","0",,,,,,,,,,,
|
||||
,"21","3","0","0","0","0",-1,0,"0","0","0","6","4098333600","4098340800","no","0",,,,,,,,,,,
|
||||
,"22","3","0","0","0","0",-1,0,"0","0","0","6","4098938400","4098945600","no","0",,,,,,,,,,,
|
||||
,"23","3","0","0","0","0",-1,0,"0","0","0","6","4097815200","4097822400","no","0",,,,,,,,,,,
|
||||
,"24","3","0","0","0","0",-1,0,"0","0","0","6","4098420000","4098427200","no","0",,,,,,,,,,,
|
||||
,"25","3","0","0","0","0",-1,0,"0","0","0","6","4099024800","4099032000","no","0",,,,,,,,,,,
|
||||
,"26","3","0","0","0","0",-1,0,"0","0","0","6","4101645600","4101649200","no","0",,,,,,,,,,,
|
||||
,"1","2","0","0","0","0",-1,0,"0","0","0","1","1671458400","1671463800","no","0",,,,,,,,,,,
|
||||
,"2","2","0","0","0","0",-1,0,"0","0","0","2","1671199200","1671204600","no","0",,,,,,,,,,,
|
||||
,"3","2","0","0","0","0",-1,0,"0","0","0","2",1648803600,1648810800,"no","0",,,,,,,,,,,
|
||||
,"4","2","0","0","0","0",-1,0,"0","0","0","2",1648890000,1648897200,"no","0",,,,,,,,,,,
|
||||
,"5","2","0","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0",,,,,,,,,,,
|
||||
,"6","2","0","0","0","0",-1,0,"0","0","0","3","1669917600","1669921200","no","0",,,,,,,,,,,
|
||||
,"7","2","0","0","0","0",-1,0,"0","0","0","3","1667642400","1667649600","no","0",,,,,,,,,,,
|
||||
,"8","2","0","0","0","0",-1,0,"0","0","0","3","1668247200","1668254400","no","0",,,,,,,,,,,
|
||||
,"9","2","0","0","0","0",-1,0,"0","0","0","3","1668852000","1668859200","no","0",,,,,,,,,,,
|
||||
,"10","2","0","0","0","0",-1,0,"0","0","0","3","1667728800","1667736000","no","0",,,,,,,,,,,
|
||||
,"11","2","0","0","0","0",-1,0,"0","0","0","3","1668333600","1668340800","no","0",,,,,,,,,,,
|
||||
,"12","2","0","0","0","0",-1,0,"0","0","0","3","1668938400","1668945600","no","0",,,,,,,,,,,
|
||||
,"13","2","0","0","0","0",-1,0,"0","0","0","3","1671732000","1671735600","no","0",,,,,,,,,,,
|
||||
,"14","3","0","0","0","0",-1,0,"0","0","0","4","1671458400","1671463800","no","0",,,,,,,,,,,
|
||||
,"15","3","0","0","0","0",-1,0,"0","0","0","5","1671199200","1671204600","no","0",,,,,,,,,,,
|
||||
,"16","3","0","0","0","0",-1,0,"0","0","0","5",1648803600,1648810800,"no","0",,,,,,,,,,,
|
||||
,"17","3","0","0","0","0",-1,0,"0","0","0","5",1648890000,1648897200,"no","0",,,,,,,,,,,
|
||||
,"18","3","0","0","0","0",-1,0,"0","0","0","5","1645106400","1645113600","no","0",,,,,,,,,,,
|
||||
,"19","3","0","0","0","0",-1,0,"0","0","0","6","1669917600","1669921200","no","0",,,,,,,,,,,
|
||||
,"20","3","0","0","0","0",-1,0,"0","0","0","6","1667642400","1667649600","no","0",,,,,,,,,,,
|
||||
,"21","3","0","0","0","0",-1,0,"0","0","0","6","1668247200","1668254400","no","0",,,,,,,,,,,
|
||||
,"22","3","0","0","0","0",-1,0,"0","0","0","6","1668852000","1668859200","no","0",,,,,,,,,,,
|
||||
,"23","3","0","0","0","0",-1,0,"0","0","0","6","1667728800","1667736000","no","0",,,,,,,,,,,
|
||||
,"24","3","0","0","0","0",-1,0,"0","0","0","6","1668333600","1668340800","no","0",,,,,,,,,,,
|
||||
,"25","3","0","0","0","0",-1,0,"0","0","0","6","1668938400","1668945600","no","0",,,,,,,,,,,
|
||||
,"26","3","0","0","0","0",-1,0,"0","0","0","6","1671732000","1671735600","no","0",,,,,,,,,,,
|
||||
"sys_category",,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","title","items","parent",,,,,,,,,,,,,,,,
|
||||
,1,2,0,0,0,0,0,0,"Top Category",0,0,,,,,,,,,,,,,,,,
|
||||
|
|
|
|
@ -18,19 +18,19 @@ Bitte beachten Sie die derzeit geltenden Zugangsregeln.",,"http://www.stadtbibli
|
|||
Es gilt die 2G-PLUS-Regel.",,,,,,,,"1","2",,"8","3",,"1",,3,,,,,,,,
|
||||
"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link",,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"1","2","0","0","0","0",-1,0,"0","0","0","1","4101372000","4101377400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"2","2","0","0","0","0",-1,0,"0","0","0","2","4101112800","4101118200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"3","2","0","0","0","0",-1,0,"0","0","0","2",4078717200,4078724400,"no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"4","2","0","0","0","0",-1,0,"0","0","0","2",4078803600,4078810800,"no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"5","2","0","0","0","0",-1,0,"0","0","0","2","4075020000","4075027200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"6","2","0","0","0","0",-1,0,"0","0","0","3","4099831200","4099834800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"7","2","0","0","0","0",-1,0,"0","0","0","3","4097728800","4097736000","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"8","2","0","0","0","0",-1,0,"0","0","0","3","4098333600","4098340800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"9","2","0","0","0","0",-1,0,"0","0","0","3","4098938400","4098945600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"10","2","0","0","0","0",-1,0,"0","0","0","3","4097815200","4097822400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"11","2","0","0","0","0",-1,0,"0","0","0","3","4098420000","4098427200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"12","2","0","0","0","0",-1,0,"0","0","0","3","4099024800","4099032000","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"13","2","0","0","0","0",-1,0,"0","0","0","3","4101645600","4101649200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"1","2","0","0","0","0",-1,0,"0","0","0","1","1671458400","1671463800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"2","2","0","0","0","0",-1,0,"0","0","0","2","1671199200","1671204600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"3","2","0","0","0","0",-1,0,"0","0","0","2",1648803600,1648810800,"no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"4","2","0","0","0","0",-1,0,"0","0","0","2",1648890000,1648897200,"no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"5","2","0","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"6","2","0","0","0","0",-1,0,"0","0","0","3","1669917600","1669921200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"7","2","0","0","0","0",-1,0,"0","0","0","3","1667642400","1667649600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"8","2","0","0","0","0",-1,0,"0","0","0","3","1668247200","1668254400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"9","2","0","0","0","0",-1,0,"0","0","0","3","1668852000","1668859200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"10","2","0","0","0","0",-1,0,"0","0","0","3","1667728800","1667736000","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"11","2","0","0","0","0",-1,0,"0","0","0","3","1668333600","1668340800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"12","2","0","0","0","0",-1,0,"0","0","0","3","1668938400","1668945600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"13","2","0","0","0","0",-1,0,"0","0","0","3","1671732000","1671735600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
"tx_events_domain_model_location",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","name","street","district","city","zip","country","latitude","longitude","phone",,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,"1","2","0","0","0","0",-1,0,"0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","50.720971023259","11.335229873657","+ 49 3672 / 486470",,,,,,,,,,,,,,,,,,,,,,,,
|
||||
|
|
|
|
@ -88,8 +88,8 @@
|
|||
"timeIntervals": [
|
||||
{
|
||||
"weekdays": [],
|
||||
"start": "2099-12-19T15:00:00+01:00",
|
||||
"end": "2099-12-19T16:30:00+01:00",
|
||||
"start": "2022-12-19T15:00:00+01:00",
|
||||
"end": "2022-12-19T16:30:00+01:00",
|
||||
"tz": "Europe/Berlin",
|
||||
"interval": 1
|
||||
}
|
||||
|
@ -117,11 +117,11 @@
|
|||
},
|
||||
{
|
||||
"key": "interval_first_match_start",
|
||||
"value": "2099-12-19T15:00:00+01"
|
||||
"value": "2022-12-19T15:00:00+01"
|
||||
},
|
||||
{
|
||||
"key": "interval_first_match_end",
|
||||
"value": "2099-12-19T16:30:00+01"
|
||||
"value": "2022-12-19T16:30:00+01"
|
||||
},
|
||||
{
|
||||
"key": "interval_match_count",
|
||||
|
@ -165,8 +165,8 @@
|
|||
"rel": "organizer"
|
||||
}
|
||||
],
|
||||
"created": "2099-10-31T12:29:00+00:00",
|
||||
"changed": "2099-12-14T08:29:00+00:00",
|
||||
"created": "2022-10-31T12:29:00+00:00",
|
||||
"changed": "2022-12-14T08:29:00+00:00",
|
||||
"source": {
|
||||
"url": "http://destination.one/",
|
||||
"value": "destination.one"
|
||||
|
@ -262,24 +262,24 @@
|
|||
"timeIntervals": [
|
||||
{
|
||||
"weekdays": [],
|
||||
"start": "2099-12-16T15:00:00+01:00",
|
||||
"end": "2099-12-16T16:30:00+01:00",
|
||||
"start": "2022-12-16T15:00:00+01:00",
|
||||
"end": "2022-12-16T16:30:00+01:00",
|
||||
"tz": "Europe/Berlin",
|
||||
"interval": 1
|
||||
},
|
||||
{
|
||||
"weekdays": [],
|
||||
"start": "2099-04-01T11:00:00+02:00",
|
||||
"end": "2099-04-01T13:00:00+02:00",
|
||||
"repeatUntil": "2099-04-03T00:00+02:00",
|
||||
"start": "2022-04-01T11:00:00+02:00",
|
||||
"end": "2022-04-01T13:00:00+02:00",
|
||||
"repeatUntil": "2022-04-03T00:00+02:00",
|
||||
"tz": "Europe/Berlin",
|
||||
"freq": "Daily",
|
||||
"interval": 1
|
||||
},
|
||||
{
|
||||
"weekdays": [],
|
||||
"start": "2099-02-17T15:00:00+01:00",
|
||||
"end": "2099-02-17T17:00:00+01:00",
|
||||
"start": "2022-02-17T15:00:00+01:00",
|
||||
"end": "2022-02-17T17:00:00+01:00",
|
||||
"tz": "Europe/Berlin",
|
||||
"interval": 1
|
||||
}
|
||||
|
@ -307,11 +307,11 @@
|
|||
},
|
||||
{
|
||||
"key": "interval_first_match_start",
|
||||
"value": "2099-12-16T15:00:00+01"
|
||||
"value": "2022-12-16T15:00:00+01"
|
||||
},
|
||||
{
|
||||
"key": "interval_first_match_end",
|
||||
"value": "2099-12-16T16:30:00+01"
|
||||
"value": "2022-12-16T16:30:00+01"
|
||||
},
|
||||
{
|
||||
"key": "interval_match_count",
|
||||
|
@ -356,8 +356,8 @@
|
|||
"rel": "organizer"
|
||||
}
|
||||
],
|
||||
"created": "2099-11-10T23:02:00+00:00",
|
||||
"changed": "2099-12-14T08:28:00+00:00",
|
||||
"created": "2022-11-10T23:02:00+00:00",
|
||||
"changed": "2022-12-14T08:28:00+00:00",
|
||||
"source": {
|
||||
"url": "http://destination.one/",
|
||||
"value": "destination.one"
|
||||
|
@ -444,8 +444,8 @@
|
|||
"timeIntervals": [
|
||||
{
|
||||
"weekdays": [],
|
||||
"start": "2099-12-01T19:00:00+01:00",
|
||||
"end": "2099-12-01T20:00:00+01:00",
|
||||
"start": "2022-12-01T19:00:00+01:00",
|
||||
"end": "2022-12-01T20:00:00+01:00",
|
||||
"tz": "Europe/Berlin",
|
||||
"interval": 1
|
||||
},
|
||||
|
@ -454,17 +454,17 @@
|
|||
"Saturday",
|
||||
"Sunday"
|
||||
],
|
||||
"start": "2099-11-02T11:00:00+01:00",
|
||||
"end": "2099-11-02T13:00:00+01:00",
|
||||
"repeatUntil": "2099-11-25T13:00:00+01:00",
|
||||
"start": "2022-11-02T11:00:00+01:00",
|
||||
"end": "2022-11-02T13:00:00+01:00",
|
||||
"repeatUntil": "2022-11-25T13:00:00+01:00",
|
||||
"tz": "Europe/Berlin",
|
||||
"freq": "Weekly",
|
||||
"interval": 1
|
||||
},
|
||||
{
|
||||
"weekdays": [],
|
||||
"start": "2099-12-22T19:00:00+01:00",
|
||||
"end": "2099-12-22T20:00:00+01:00",
|
||||
"start": "2022-12-22T19:00:00+01:00",
|
||||
"end": "2022-12-22T20:00:00+01:00",
|
||||
"tz": "Europe/Berlin",
|
||||
"interval": 1
|
||||
}
|
||||
|
@ -492,11 +492,11 @@
|
|||
},
|
||||
{
|
||||
"key": "interval_first_match_start",
|
||||
"value": "2099-12-15T19:00:00+01"
|
||||
"value": "2022-12-15T19:00:00+01"
|
||||
},
|
||||
{
|
||||
"key": "interval_first_match_end",
|
||||
"value": "2099-12-15T20:00:00+01"
|
||||
"value": "2022-12-15T20:00:00+01"
|
||||
},
|
||||
{
|
||||
"key": "interval_match_count",
|
||||
|
@ -504,11 +504,11 @@
|
|||
},
|
||||
{
|
||||
"key": "interval_last_match_start",
|
||||
"value": "2099-12-22T19:00:00+01"
|
||||
"value": "2022-12-22T19:00:00+01"
|
||||
},
|
||||
{
|
||||
"key": "interval_last_match_end",
|
||||
"value": "2099-12-22T20:00:00+01"
|
||||
"value": "2022-12-22T20:00:00+01"
|
||||
}
|
||||
],
|
||||
"features": [],
|
||||
|
@ -538,8 +538,8 @@
|
|||
"rel": "organizer"
|
||||
}
|
||||
],
|
||||
"created": "2099-11-08T22:15:00+00:00",
|
||||
"changed": "2099-12-14T08:38:00+00:00",
|
||||
"created": "2022-11-08T22:15:00+00:00",
|
||||
"changed": "2022-12-14T08:38:00+00:00",
|
||||
"source": {
|
||||
"url": "http://destination.one/",
|
||||
"value": "destination.one"
|
||||
|
|
|
@ -16,6 +16,8 @@ class ImportsAllConfigurationTest extends AbstractTest
|
|||
*/
|
||||
public function importsConfiguration(): void
|
||||
{
|
||||
$this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin')));
|
||||
|
||||
$fileImportPathConfiguration1 = 'staedte/beispielstadt/events/';
|
||||
$fileImportPath1 = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration1;
|
||||
GeneralUtility::mkdir_deep($fileImportPath1);
|
||||
|
|
|
@ -15,6 +15,8 @@ class ImportsExampleAsExpectedTest extends AbstractTest
|
|||
*/
|
||||
public function importsExampleAsExpected(): void
|
||||
{
|
||||
$this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin')));
|
||||
|
||||
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
|
||||
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
|
||||
GeneralUtility::mkdir_deep($fileImportPath);
|
||||
|
|
|
@ -16,6 +16,8 @@ class ImportsSingleConfigurationTest extends AbstractTest
|
|||
*/
|
||||
public function importsConfiguration(): void
|
||||
{
|
||||
$this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin')));
|
||||
|
||||
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
|
||||
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
|
||||
GeneralUtility::mkdir_deep($fileImportPath);
|
||||
|
|
|
@ -6,26 +6,22 @@ namespace Wrm\Events\Tests\Unit\Service\DestinationDataImportService;
|
|||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
use TYPO3\CMS\Core\Context\DateTimeAspect;
|
||||
use Wrm\Events\Domain\Model\Date;
|
||||
use Wrm\Events\Service\DestinationDataImportService\DatesFactory;
|
||||
use Wrm\Events\Tests\ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @covers \Wrm\Events\Service\DestinationDataImportService\DatesFactory
|
||||
*/
|
||||
class DatesFactoryTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function canBeCreated(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('now'))
|
||||
);
|
||||
|
||||
self::assertInstanceOf(
|
||||
|
@ -40,10 +36,8 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsNoResultOnUnkownInput(array $unkownInput): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-01-01T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates($unkownInput, false);
|
||||
|
@ -72,15 +66,13 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsSingleNotCanceledDate(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-01-01T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([[
|
||||
'start' => '2099-06-21T16:00:00+02:00',
|
||||
'end' => '2099-06-21T22:00:00+02:00',
|
||||
'start' => '2022-04-01T16:00:00+02:00',
|
||||
'end' => '2022-04-01T17:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'interval' => 1,
|
||||
]], false);
|
||||
|
@ -92,8 +84,8 @@ class DatesFactoryTest extends TestCase
|
|||
self::assertCount(1, $result);
|
||||
|
||||
self::assertInstanceOf(Date::class, $firstEntry);
|
||||
self::assertSame('4085733600', $firstEntry->getStart()->format('U'));
|
||||
self::assertSame('4085755200', $firstEntry->getEnd()->format('U'));
|
||||
self::assertSame(1648821600, $firstEntry->getStart()->getTimestamp());
|
||||
self::assertSame(1648825200, $firstEntry->getEnd()->getTimestamp());
|
||||
self::assertSame('no', $firstEntry->getCanceled());
|
||||
}
|
||||
|
||||
|
@ -102,28 +94,27 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsSingleCanceledDate(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-01-01T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([[
|
||||
'start' => '2099-06-21T16:00:00+02:00',
|
||||
'end' => '2099-06-21T22:00:00+02:00',
|
||||
'start' => '2022-04-01T16:00:00+02:00',
|
||||
'end' => '2022-04-01T17:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'interval' => 1,
|
||||
]], true);
|
||||
|
||||
self::assertInstanceOf(\Generator::class, $result);
|
||||
$result = iterator_to_array($result);
|
||||
|
||||
$firstEntry = $result->current();
|
||||
|
||||
self::assertCount(1, $result);
|
||||
|
||||
self::assertInstanceOf(Date::class, $result[0]);
|
||||
self::assertSame('4085733600', $result[0]->getStart()->format('U'));
|
||||
self::assertSame('4085755200', $result[0]->getEnd()->format('U'));
|
||||
self::assertSame('canceled', $result[0]->getCanceled());
|
||||
self::assertInstanceOf(Date::class, $firstEntry);
|
||||
self::assertSame(1648821600, $firstEntry->getStart()->getTimestamp());
|
||||
self::assertSame(1648825200, $firstEntry->getEnd()->getTimestamp());
|
||||
self::assertSame('canceled', $firstEntry->getCanceled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,16 +122,14 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsCanceledDatesOnDailyBasis(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-01-01T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([[
|
||||
'start' => '2099-04-01T16:00:00+02:00',
|
||||
'end' => '2099-04-01T17:00:00+02:00',
|
||||
'repeatUntil' => '2099-04-03T18:00:00+02:00',
|
||||
'start' => '2022-10-29T16:00:00+02:00',
|
||||
'end' => '2022-10-29T17:00:00+02:00',
|
||||
'repeatUntil' => '2022-11-02T17:00:00+01:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Daily',
|
||||
'interval' => 1,
|
||||
|
@ -149,16 +138,16 @@ class DatesFactoryTest extends TestCase
|
|||
self::assertInstanceOf(\Generator::class, $result);
|
||||
$result = iterator_to_array($result);
|
||||
|
||||
self::assertCount(3, $result);
|
||||
self::assertCount(5, $result);
|
||||
|
||||
self::assertInstanceOf(Date::class, $result[0]);
|
||||
self::assertSame('4078735200', $result[0]->getStart()->format('U'));
|
||||
self::assertSame('4078738800', $result[0]->getEnd()->format('U'));
|
||||
self::assertSame(1667052000, $result[0]->getStart()->getTimestamp());
|
||||
self::assertSame(1667055600, $result[0]->getEnd()->getTimestamp());
|
||||
self::assertSame('canceled', $result[0]->getCanceled());
|
||||
|
||||
self::assertSame('4078908000', $result[2]->getStart()->format('U'));
|
||||
self::assertSame('4078911600', $result[2]->getEnd()->format('U'));
|
||||
self::assertSame('canceled', $result[2]->getCanceled());
|
||||
self::assertSame(1667401200, $result[4]->getStart()->getTimestamp());
|
||||
self::assertSame(1667404800, $result[4]->getEnd()->getTimestamp());
|
||||
self::assertSame('canceled', $result[4]->getCanceled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,16 +155,14 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsNotCanceledDatesOnDailyBasis(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-08-29T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([[
|
||||
'start' => '2099-04-01T16:00:00+02:00',
|
||||
'end' => '2099-04-01T17:00:00+02:00',
|
||||
'repeatUntil' => '2099-04-03T18:00:00+02:00',
|
||||
'start' => '2022-10-29T16:00:00+02:00',
|
||||
'end' => '2022-10-29T17:00:00+02:00',
|
||||
'repeatUntil' => '2022-11-02T17:00:00+01:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Daily',
|
||||
'interval' => 1,
|
||||
|
@ -184,16 +171,16 @@ class DatesFactoryTest extends TestCase
|
|||
self::assertInstanceOf(\Generator::class, $result);
|
||||
$result = iterator_to_array($result);
|
||||
|
||||
self::assertCount(3, $result);
|
||||
self::assertCount(5, $result);
|
||||
|
||||
self::assertInstanceOf(Date::class, $result[0]);
|
||||
self::assertSame('4078735200', $result[0]->getStart()->format('U'));
|
||||
self::assertSame('4078738800', $result[0]->getEnd()->format('U'));
|
||||
self::assertSame(1667052000, $result[0]->getStart()->getTimestamp());
|
||||
self::assertSame(1667055600, $result[0]->getEnd()->getTimestamp());
|
||||
self::assertSame('no', $result[0]->getCanceled());
|
||||
|
||||
self::assertSame('4078908000', $result[2]->getStart()->format('U'));
|
||||
self::assertSame('4078911600', $result[2]->getEnd()->format('U'));
|
||||
self::assertSame('no', $result[2]->getCanceled());
|
||||
self::assertSame(1667401200, $result[4]->getStart()->getTimestamp());
|
||||
self::assertSame(1667404800, $result[4]->getEnd()->getTimestamp());
|
||||
self::assertSame('no', $result[4]->getCanceled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,10 +188,8 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsCanceledDatesOnWeeklyBasis(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-08-29T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([[
|
||||
|
@ -212,9 +197,9 @@ class DatesFactoryTest extends TestCase
|
|||
'Saturday',
|
||||
'Sunday',
|
||||
],
|
||||
'start' => '2099-03-02T11:00:00+01:00',
|
||||
'end' => '2099-03-02T13:00:00+01:00',
|
||||
'repeatUntil' => '2099-03-15T13:00:00+02:00',
|
||||
'start' => '2022-10-29T16:00:00+02:00',
|
||||
'end' => '2022-10-29T17:00:00+02:00',
|
||||
'repeatUntil' => '2022-11-06T17:00:00+01:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Weekly',
|
||||
'interval' => 1,
|
||||
|
@ -226,12 +211,20 @@ class DatesFactoryTest extends TestCase
|
|||
self::assertCount(4, $result);
|
||||
|
||||
self::assertInstanceOf(Date::class, $result[0]);
|
||||
self::assertSame('4076560800', $result[0]->getStart()->format('U'));
|
||||
self::assertSame('4076568000', $result[0]->getEnd()->format('U'));
|
||||
self::assertSame(1667052000, $result[0]->getStart()->getTimestamp());
|
||||
self::assertSame(1667055600, $result[0]->getEnd()->getTimestamp());
|
||||
self::assertSame('canceled', $result[0]->getCanceled());
|
||||
|
||||
self::assertSame('4077252000', $result[3]->getStart()->format('U'));
|
||||
self::assertSame('4077259200', $result[3]->getEnd()->format('U'));
|
||||
self::assertSame(1667660400, $result[1]->getStart()->getTimestamp());
|
||||
self::assertSame(1667664000, $result[1]->getEnd()->getTimestamp());
|
||||
self::assertSame('canceled', $result[1]->getCanceled());
|
||||
|
||||
self::assertSame(1667142000, $result[2]->getStart()->getTimestamp());
|
||||
self::assertSame(1667145600, $result[2]->getEnd()->getTimestamp());
|
||||
self::assertSame('canceled', $result[2]->getCanceled());
|
||||
|
||||
self::assertSame(1667746800, $result[3]->getStart()->getTimestamp());
|
||||
self::assertSame(1667750400, $result[3]->getEnd()->getTimestamp());
|
||||
self::assertSame('canceled', $result[3]->getCanceled());
|
||||
}
|
||||
|
||||
|
@ -240,10 +233,8 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsNotCanceledDatesOnWeeklyBasis(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-08-29T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([[
|
||||
|
@ -251,9 +242,9 @@ class DatesFactoryTest extends TestCase
|
|||
'Saturday',
|
||||
'Sunday',
|
||||
],
|
||||
'start' => '2099-03-02T11:00:00+01:00',
|
||||
'end' => '2099-03-02T13:00:00+01:00',
|
||||
'repeatUntil' => '2099-03-15T13:00:00+02:00',
|
||||
'start' => '2022-10-29T16:00:00+02:00',
|
||||
'end' => '2022-10-29T17:00:00+02:00',
|
||||
'repeatUntil' => '2022-11-06T17:00:00+01:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Weekly',
|
||||
'interval' => 1,
|
||||
|
@ -265,12 +256,20 @@ class DatesFactoryTest extends TestCase
|
|||
self::assertCount(4, $result);
|
||||
|
||||
self::assertInstanceOf(Date::class, $result[0]);
|
||||
self::assertSame('4076560800', $result[0]->getStart()->format('U'));
|
||||
self::assertSame('4076568000', $result[0]->getEnd()->format('U'));
|
||||
self::assertSame(1667052000, $result[0]->getStart()->getTimestamp());
|
||||
self::assertSame(1667055600, $result[0]->getEnd()->getTimestamp());
|
||||
self::assertSame('no', $result[0]->getCanceled());
|
||||
|
||||
self::assertSame('4077252000', $result[3]->getStart()->format('U'));
|
||||
self::assertSame('4077259200', $result[3]->getEnd()->format('U'));
|
||||
self::assertSame(1667660400, $result[1]->getStart()->getTimestamp());
|
||||
self::assertSame(1667664000, $result[1]->getEnd()->getTimestamp());
|
||||
self::assertSame('no', $result[1]->getCanceled());
|
||||
|
||||
self::assertSame(1667142000, $result[2]->getStart()->getTimestamp());
|
||||
self::assertSame(1667145600, $result[2]->getEnd()->getTimestamp());
|
||||
self::assertSame('no', $result[2]->getCanceled());
|
||||
|
||||
self::assertSame(1667746800, $result[3]->getStart()->getTimestamp());
|
||||
self::assertSame(1667750400, $result[3]->getEnd()->getTimestamp());
|
||||
self::assertSame('no', $result[3]->getCanceled());
|
||||
}
|
||||
|
||||
|
@ -279,23 +278,21 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsCanceledDatesOnMixedIntervals(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-01-01T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([
|
||||
[
|
||||
'start' => '2099-06-21T16:00:00+02:00',
|
||||
'end' => '2099-06-21T22:00:00+02:00',
|
||||
'start' => '2022-06-21T16:00:00+02:00',
|
||||
'end' => '2022-06-21T22:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'interval' => 1,
|
||||
],
|
||||
[
|
||||
'start' => '2099-04-01T16:00:00+02:00',
|
||||
'end' => '2099-04-01T17:00:00+02:00',
|
||||
'repeatUntil' => '2099-04-03T18:00:00+02:00',
|
||||
'start' => '2022-04-01T16:00:00+02:00',
|
||||
'end' => '2022-04-01T17:00:00+02:00',
|
||||
'repeatUntil' => '2022-04-03T18:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Daily',
|
||||
'interval' => 1,
|
||||
|
@ -305,9 +302,9 @@ class DatesFactoryTest extends TestCase
|
|||
'Saturday',
|
||||
'Sunday',
|
||||
],
|
||||
'start' => '2099-03-02T11:00:00+01:00',
|
||||
'end' => '2099-03-02T13:00:00+01:00',
|
||||
'repeatUntil' => '2099-03-15T13:00:00+02:00',
|
||||
'start' => '2022-03-02T11:00:00+01:00',
|
||||
'end' => '2022-03-02T13:00:00+01:00',
|
||||
'repeatUntil' => '2022-03-15T13:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Weekly',
|
||||
'interval' => 1,
|
||||
|
@ -330,23 +327,21 @@ class DatesFactoryTest extends TestCase
|
|||
*/
|
||||
public function returnsNotCanceledDatesOnMixedIntervals(): void
|
||||
{
|
||||
$context = $this->prophesize(Context::class);
|
||||
|
||||
$subject = new DatesFactory(
|
||||
$context->reveal()
|
||||
$this->getContext(new \DateTimeImmutable('2022-01-01T13:17:24 Europe/Berlin'))
|
||||
);
|
||||
|
||||
$result = $subject->createDates([
|
||||
[
|
||||
'start' => '2099-06-21T16:00:00+02:00',
|
||||
'end' => '2099-06-21T22:00:00+02:00',
|
||||
'start' => '2022-06-21T16:00:00+02:00',
|
||||
'end' => '2022-06-21T22:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'interval' => 1,
|
||||
],
|
||||
[
|
||||
'start' => '2099-04-01T16:00:00+02:00',
|
||||
'end' => '2099-04-01T17:00:00+02:00',
|
||||
'repeatUntil' => '2099-04-03T18:00:00+02:00',
|
||||
'start' => '2022-04-01T16:00:00+02:00',
|
||||
'end' => '2022-04-01T17:00:00+02:00',
|
||||
'repeatUntil' => '2022-04-03T18:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Daily',
|
||||
'interval' => 1,
|
||||
|
@ -356,9 +351,9 @@ class DatesFactoryTest extends TestCase
|
|||
'Saturday',
|
||||
'Sunday',
|
||||
],
|
||||
'start' => '2099-03-02T11:00:00+01:00',
|
||||
'end' => '2099-03-02T13:00:00+01:00',
|
||||
'repeatUntil' => '2099-03-15T13:00:00+02:00',
|
||||
'start' => '2022-03-02T11:00:00+01:00',
|
||||
'end' => '2022-03-02T13:00:00+01:00',
|
||||
'repeatUntil' => '2022-03-15T13:00:00+02:00',
|
||||
'tz' => 'Europe/Berlin',
|
||||
'freq' => 'Weekly',
|
||||
'interval' => 1,
|
||||
|
@ -375,4 +370,11 @@ class DatesFactoryTest extends TestCase
|
|||
self::assertSame('no', $date->getCanceled());
|
||||
}
|
||||
}
|
||||
|
||||
private function getContext(\DateTimeImmutable $dateTime): Context
|
||||
{
|
||||
$context = new Context();
|
||||
$context->setAspect('date', new DateTimeAspect($dateTime));
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue