From 6e6e914e367979c9f3527236a8f9cbcf06128575 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 13 Jul 2022 13:58:05 +0000 Subject: [PATCH] Ensure first date of recurring daily event is created --- .../Service/DestinationDataImportService.php | 30 ++- .../DatesFactory.php | 45 ++--- Documentation/Changelog/2.4.4.rst | 28 +++ .../DestinationDataTest/AbstractTest.php | 16 ++ ...rtDoesntEndUpInEndlessDateCreationTest.csv | 7 +- .../ImportsAllConfigurationTest.csv | 8 +- .../Assertions/ImportsExampleAsExpected.csv | 4 +- .../ImportsFirstDateOfRecurringDatesDaily.csv | 10 + ...ImportsFirstDateOfRecurringDatesWeekly.csv | 8 + .../ImportsFirstDateOfSingleDate.csv | 6 + .../ImportsWithoutCategoryIfNotProvided.csv | 15 -- .../ImportsWithoutRegionIfNotProvided.csv | 15 -- ...ateOfRecurringDatesImportConfiguration.xml | 16 ++ .../Fixtures/ResponseWithRecurringDaily.json | 190 ++++++++++++++++++ .../Fixtures/ResponseWithRecurringWeekly.json | 176 ++++++++++++++++ .../Fixtures/ResponseWithSingleDate.json | 111 ++++++++++ ...rtDoesntEndUpInEndlessDateCreationTest.php | 13 +- .../ImportsFirstDateOfDatesTest.php | 74 +++++++ .../DatesFactoryTest.php | 16 +- ext_emconf.php | 2 +- phpunit.xml.dist | 1 + 21 files changed, 693 insertions(+), 98 deletions(-) create mode 100644 Documentation/Changelog/2.4.4.rst create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv create mode 100644 Tests/Functional/Import/DestinationDataTest/Fixtures/FirstDateOfRecurringDatesImportConfiguration.xml create mode 100644 Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringDaily.json create mode 100644 Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringWeekly.json create mode 100644 Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithSingleDate.json create mode 100644 Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 33edc7a..dd96be5 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -190,47 +190,57 @@ class DestinationDataImportService $this->tmpCurrentEvent->setTitle(substr($event['title'], 0, 254)); // Set Highlight (Is only set in rest if true) - if (isset($event['highlight']) && $event['highlight']) { + if ($event['highlight'] ?? false) { $this->tmpCurrentEvent->setHighlight($event['highlight']); } // Set Texts - if ($event['texts']) { + if ($event['texts'] ?? false) { $this->setTexts($event['texts']); } // Set address and geo data - if ($event['name'] || $event['street'] || $event['city'] || $event['zip'] || $event['country'] || $event['web']) { + if ( + ($event['name'] ?? false) + || ($event['street'] ?? false) + || ($event['city'] ?? false) + || ($event['zip'] ?? false) + || ($event['country'] ?? false) + || ($event['web'] ?? false) + ) { $this->setAddress($event); } // Set LatLng - if ($event['geo']['main']['latitude'] && $event['geo']['main']['longitude']) { + if ( + ($event['geo']['main']['latitude'] ?? false) + && ($event['geo']['main']['longitude'] ?? false) + ) { $this->setLatLng($event['geo']['main']['latitude'], $event['geo']['main']['longitude']); } // Set Categories - if ($event['categories']) { + if ($event['categories'] ?? false) { $this->setCategories($event['categories']); } // Set Organizer - if ($event['addresses']) { + if ($event['addresses'] ?? false) { $this->setOrganizer($event['addresses']); } // Set Social - if ($event['media_objects']) { + if ($event['media_objects'] ?? false) { $this->setSocial($event['media_objects']); } // Set Tickets - if ($event['media_objects']) { + if ($event['media_objects'] ?? false) { $this->setTickets($event['media_objects']); } // Set Dates - if ($event['timeIntervals']) { + if ($event['timeIntervals'] ?? false) { $this->setDates( $event['timeIntervals'], (bool) $this->getAttributeValue($event, 'DETAILS_ABGESAGT') @@ -238,7 +248,7 @@ class DestinationDataImportService } // Set Assets - if ($event['media_objects']) { + if ($event['media_objects'] ?? false) { $this->setAssets($event['media_objects']); } diff --git a/Classes/Service/DestinationDataImportService/DatesFactory.php b/Classes/Service/DestinationDataImportService/DatesFactory.php index 8368dee..aef6331 100644 --- a/Classes/Service/DestinationDataImportService/DatesFactory.php +++ b/Classes/Service/DestinationDataImportService/DatesFactory.php @@ -90,7 +90,7 @@ class DatesFactory array $date, bool $canceled ): \Generator { - if (strtotime($date['start']) > $this->getToday()) { + if (new \DateTimeImmutable($date['start']) > $this->getToday()) { yield Date::createFromDestinationDataDate($date, $canceled); } } @@ -126,15 +126,16 @@ class DatesFactory $end = new \DateTimeImmutable($date['end'], $timeZone); $until = new \DateTimeImmutable($date['repeatUntil'], $timeZone); - $i = (int) strtotime($start->format('l'), $start->getTimestamp()); - while ($i !== 0 && $i <= $until->getTimestamp()) { - $i = (int) strtotime('+1 day', $i); - if ($i < $today) { + $nextDate = $start; + while ($nextDate <= $until) { + $dateToUse = $nextDate; + $nextDate = $dateToUse->modify('+1 day'); + if ($dateToUse < $today) { continue; } yield $this->createDateFromStartAndEnd( - $i, + $dateToUse, $start, $end, $canceled @@ -156,16 +157,16 @@ class DatesFactory $until = new \DateTimeImmutable($date['repeatUntil'], $timeZone); foreach ($date['weekdays'] as $day) { - $i = strtotime($day, $start->getTimestamp()); - while ($i !== 0 && $i <= $until->getTimestamp()) { - $timeStampToUse = $i; - $i = strtotime('+1 week', $i); - if ($i < $today) { + $nextDate = $start->modify($day); + while ($nextDate <= $until) { + $dateToUse = $nextDate; + $nextDate = $dateToUse->modify('+1 week'); + if ($dateToUse < $today) { continue; } yield $this->createDateFromStartAndEnd( - $timeStampToUse, + $dateToUse, $start, $end, $canceled @@ -175,35 +176,25 @@ class DatesFactory } private function createDateFromStartAndEnd( - int $timestamp, + \DateTimeImmutable $dateToUse, \DateTimeImmutable $start, \DateTimeImmutable $end, bool $canceled ): Date { - $eventStart = $start->setTimestamp($timestamp)->setTime( - (int) $start->format('H'), - (int) $start->format('i') - ); - $eventEnd = $end->setTimestamp($timestamp)->setTime( - (int) $end->format('H'), - (int) $end->format('i') - ); - return Date::createFromDestinationData( - $eventStart, - $eventEnd, + $dateToUse->setTime((int) $start->format('H'), (int) $start->format('i')), + $dateToUse->setTime((int) $end->format('H'), (int) $end->format('i')), $canceled ); } - private function getToday(): int + private function getToday(): \DateTimeImmutable { $today = $this->context->getPropertyFromAspect('date', 'full', new \DateTimeImmutable()); if (!$today instanceof \DateTimeImmutable) { $today = new \DateTimeImmutable(); } - $midnight = $today->modify('midnight'); - return (int) $midnight->format('U'); + return $today->modify('midnight'); } } diff --git a/Documentation/Changelog/2.4.4.rst b/Documentation/Changelog/2.4.4.rst new file mode 100644 index 0000000..b08902c --- /dev/null +++ b/Documentation/Changelog/2.4.4.rst @@ -0,0 +1,28 @@ +2.4.4 +===== + +Breaking +-------- + +Nothing + +Features +-------- + +Nothing + +Fixes +----- + +* Fix missing first date on import of daily events. + The first date of daily events was missing during import. + +Tasks +----- + +Nothing + +Deprecation +----------- + +Nothing diff --git a/Tests/Functional/Import/DestinationDataTest/AbstractTest.php b/Tests/Functional/Import/DestinationDataTest/AbstractTest.php index 84717b3..61cc8f4 100644 --- a/Tests/Functional/Import/DestinationDataTest/AbstractTest.php +++ b/Tests/Functional/Import/DestinationDataTest/AbstractTest.php @@ -7,6 +7,8 @@ use Psr\Http\Client\ClientInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\DependencyInjection\Container; +use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Context\DateTimeAspect; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; use Wrm\Events\Command\DestinationDataImportCommand; @@ -86,4 +88,18 @@ abstract class AbstractTest extends FunctionalTestCase return $tester; } + + /** + * @api Actual tests can use this method to define the actual date of "now". + */ + protected function setDateAspect(\DateTimeImmutable $dateTime): void + { + $context = $this->getContainer()->get(Context::class); + if (!$context instanceof Context) { + throw new \TypeError('Retrieved context was of unexpected type.', 1638182021); + } + + $aspect = new DateTimeAspect($dateTime); + $context->setAspect('date', $aspect); + } } diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv index 23be474..b073e93 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv @@ -6,9 +6,8 @@ ,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","e-100347853","0",,"Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert. Eintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke) Um Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten. -Es gilt die 2G-PLUS-Regel.",,"Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","http://www.schillerhaus.rudolstadt.de/","+ 49 3672 / 486470",,,,,"50.720971023259","11.335229873657","0","1",,"3","1",,"1", +Es gilt die 2G-PLUS-Regel.",,"Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","http://www.schillerhaus.rudolstadt.de/","+ 49 3672 / 486470",,,,,"50.720971023259","11.335229873657","0","1",,"2","1",,"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","1656144000","1656165600","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, -,"2","2","0","0","0","0",-1,0,"0","0","0","1","1656748800","1656770400","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, -,"3","2","0","0","0","0",-1,0,"0","0","0","1","1657353600","1657375200","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, +,"1","2","0","0","0","0",-1,0,"0","0","0","1",1656748800,1656770400,"no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, +,"2","2","0","0","0","0",-1,0,"0","0","0","1",1657353600,1657375200,"no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv index 7cdedaf..80988d3 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv @@ -34,8 +34,8 @@ Es gilt die 2G-PLUS-Regel.",,"Lutherkirche","Caspar-Schulte-Straße",,"Rudolstad ,"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","4078803600","4078810800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, -,"4","2","0","0","0","0",-1,0,"0","0","0","2","4078890000","4078897200","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",,,,,,,,,,,,,,,,,,,,,,,,,,, @@ -47,8 +47,8 @@ Es gilt die 2G-PLUS-Regel.",,"Lutherkirche","Caspar-Schulte-Straße",,"Rudolstad ,"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","4078803600","4078810800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, -,"17","3","0","0","0","0",-1,0,"0","0","0","5","4078890000","4078897200","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",,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv index f9b740b..f0329b6 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv @@ -20,8 +20,8 @@ Es gilt die 2G-PLUS-Regel.",,"Lutherkirche","Caspar-Schulte-Straße",,"Rudolstad ,"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","4078803600","4078810800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, -,"4","2","0","0","0","0",-1,0,"0","0","0","2","4078890000","4078897200","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",,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv new file mode 100644 index 0000000..e5abe09 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv @@ -0,0 +1,10 @@ +"tx_events_domain_model_event",,,,, +,"uid","pid","title","global_id","dates" +,"1","2","Kurzführung - Historische Altstadt","e_100354481",5 +"tx_events_domain_model_date",,,,, +,"uid","pid","event","start","end" +,"1","2",1,1657720800,1657724400 +,"2","2",1,1657807200,1657810800 +,"3","2",1,1657893600,1657897200 +,"4","2",1,1657980000,1657983600 +,"5","2",1,1658066400,1658070000 diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv new file mode 100644 index 0000000..90d5134 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv @@ -0,0 +1,8 @@ +"tx_events_domain_model_event",,,,, +,"uid","pid","title","global_id","dates" +,"1","2","Tüftlerzeit","e_100354481",3 +"tx_events_domain_model_date",,,,, +,"uid","pid","event","start","end" +,"1","2",1,1657958400,1657980000 +,"2","2",1,1658563200,1658584800 +,"3","2",1,1659168000,1659189600 diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv new file mode 100644 index 0000000..3eb8b46 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv @@ -0,0 +1,6 @@ +"tx_events_domain_model_event",,,,, +,"uid","pid","title","global_id","dates" +,"1","2","Kurzführung - Historische Altstadt","e_100354481",1 +"tx_events_domain_model_date",,,,, +,"uid","pid","event","start","end" +,"1","2",1,1657717200,1657722600 diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.csv index a63ea9b..cd685eb 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.csv @@ -16,18 +16,3 @@ Bitte beachten Sie die derzeit geltenden Zugangsregeln.",,"Stadtbibliothek Rudol ,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","e-100350503","0",,"Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss. Es gilt die 2G-PLUS-Regel.",,"Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","Deutschland",,"03672 - 48 96 13",,,,,"50.718688721183","11.327333450317","1","0",,"8","3",,"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","4078803600","4078810800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, -,"4","2","0","0","0","0",-1,0,"0","0","0","2","4078890000","4078897200","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",,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv index 0d0c441..472da67 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv @@ -16,21 +16,6 @@ Bitte beachten Sie die derzeit geltenden Zugangsregeln.",,"Stadtbibliothek Rudol ,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","e-100350503","0",,"Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss. Es gilt die 2G-PLUS-Regel.",,"Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","Deutschland",,"03672 - 48 96 13",,,,,"50.718688721183","11.327333450317","1","2",,"8","3",,"0", -"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","4078803600","4078810800","no","0",,,,,,,,,,,,,,,,,,,,,,,,,,, -,"4","2","0","0","0","0",-1,0,"0","0","0","2","4078890000","4078897200","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",,,,,,,,,,,,,,,,,,,,,,,,,,, "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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/FirstDateOfRecurringDatesImportConfiguration.xml b/Tests/Functional/Import/DestinationDataTest/Fixtures/FirstDateOfRecurringDatesImportConfiguration.xml new file mode 100644 index 0000000..c752e0c --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/FirstDateOfRecurringDatesImportConfiguration.xml @@ -0,0 +1,16 @@ + + + + 1 + 2 + Example for test + 2 + + + + 2 + 3 + Features Storage + 254 + + diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringDaily.json b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringDaily.json new file mode 100644 index 0000000..3b5ef1b --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringDaily.json @@ -0,0 +1,190 @@ +{ + "status": "OK", + "count": 3, + "overallcount": 50, + "channels": [], + "facetGroups": [], + "items": [ + { + "global_id": "e_100354481", + "id": "100354481", + "title": "Tüftlerzeit", + "type": "Event", + "categories": [ + "Kinder" + ], + "texts": [ + { + "rel": "details", + "type": "text/html", + "value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.
Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420

Bitte beachten Sie die derzeit geltenden Zugangsregeln." + }, + { + "rel": "details", + "type": "text/plain", + "value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.\nVoranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420\n\nBitte beachten Sie die derzeit geltenden Zugangsregeln." + }, + { + "rel": "teaser", + "type": "text/html" + }, + { + "rel": "teaser", + "type": "text/plain" + } + ], + "country": "Deutschland", + "areas": [ + "Rudolstadt und Umgebung" + ], + "city": "Rudolstadt", + "zip": "07407", + "street": "Schulplatz 13", + "phone": "0 36 72 - 48 64 20", + "fax": "0 36 72 - 48 64 30", + "web": "http://www.stadtbibliothek-rudolstadt.de/", + "email": "stadtbibliothek@rudolstadt.de", + "author": "support@hubermedia.de", + "geo": { + "main": { + "latitude": 50.720835175055917, + "longitude": 11.342568397521973 + }, + "entry": [], + "attributes": [] + }, + "ratings": [ + { + "type": "eT4", + "value": 40.0 + }, + { + "type": "order", + "value": 99.0001 + } + ], + "cuisine_types": [], + "payment": [], + "media_objects": [ + ], + "keywords": [], + "timeIntervals": [ + { + "weekdays": [], + "start": "2022-07-13T11:00:00+02:00", + "end": "2022-07-13T13:00:00+02:00", + "repeatUntil": "2022-07-17T16:00+02:00", + "tz": "Europe/Berlin", + "freq": "Daily", + "interval": 1 + } + ], + "kitchenTimeIntervals": [], + "deliveryTimeIntervals": [], + "numbers": [], + "name": "Stadtbibliothek Rudolstadt", + "attributes": [ + { + "key": "VO_Id", + "value": "100042570" + }, + { + "key": "VO_CategoryName", + "value": "POI" + }, + { + "key": "VA_Id", + "value": "100042570" + }, + { + "key": "VA_CategoryName", + "value": "POI" + }, + { + "key": "interval_first_match_start", + "value": "2099-12-16T15:00:00+01" + }, + { + "key": "interval_first_match_end", + "value": "2099-12-16T16:30:00+01" + }, + { + "key": "interval_match_count", + "value": "3" + }, + { + "key": "interval_last_match_start", + "value": "2022-02-17T15:00:00+01" + }, + { + "key": "interval_last_match_end", + "value": "2022-02-17T17:00:00+01" + } + ], + "features": [ + "vorhandenes Feature", + "Barrierefrei", + "Zielgruppe Jugendliche", + "neues Feature" + ], + "addresses": [ + { + "name": "Städtetourismus in Thüringen e.V.", + "city": "Weimar", + "zip": "99423", + "street": "UNESCO-Platz 1", + "phone": "+49 (3643) 745 314", + "web": "http://www.thueringer-staedte.de", + "email": "verein@thueringer-staedte.de", + "rel": "author" + }, + { + "name": "Städtetourismus in Thüringen\" e.V.", + "web": "http://www.thueringer-staedte.de", + "email": "verein@thueringer-staedte.de", + "rel": "organisation" + }, + { + "name": "Stadtbibliothek Rudolstadt", + "city": "Rudolstadt", + "zip": "07407", + "street": "Schulplatz 13", + "phone": "0 36 72 - 48 64 20", + "fax": "0 36 72 - 48 64 30", + "web": "http://www.stadtbibliothek-rudolstadt.de ", + "email": "stadtbibliothek@rudolstadt.de", + "rel": "organizer" + } + ], + "created": "2099-11-10T23:02:00+00:00", + "changed": "2099-12-14T08:28:00+00:00", + "source": { + "url": "http://destination.one/", + "value": "destination.one" + }, + "company": "", + "district": "", + "postoffice": "", + "phone2": "", + "seasons": [], + "subitems": [], + "texts": [ + ], + "timeIntervals": [ + { + "end": "2022-04-30T17:00:00+02:00", + "freq": "Daily", + "interval": 1, + "repeatUntil": "2022-07-17T17:00:00+02:00", + "start": "2022-07-13T16:00:00+02:00", + "tz": "Europe/Berlin", + "weekdays": [] + } + ], + "title": "Kurzf\u00fchrung - Historische Altstadt", + "type": "Event", + "web": "http://www.erfurt-tourismus.de/stadtfuehrung/individuell/kurzfuehrung-historische-altstadt/", + "zip": "99084" + } + ] +} diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringWeekly.json b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringWeekly.json new file mode 100644 index 0000000..0d67903 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithRecurringWeekly.json @@ -0,0 +1,176 @@ +{ + "status": "OK", + "count": 3, + "overallcount": 50, + "channels": [], + "facetGroups": [], + "items": [ + { + "global_id": "e_100354481", + "id": "100354481", + "title": "Tüftlerzeit", + "type": "Event", + "categories": [ + "Kinder" + ], + "texts": [ + { + "rel": "details", + "type": "text/html", + "value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.
Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420

Bitte beachten Sie die derzeit geltenden Zugangsregeln." + }, + { + "rel": "details", + "type": "text/plain", + "value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.\nVoranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420\n\nBitte beachten Sie die derzeit geltenden Zugangsregeln." + }, + { + "rel": "teaser", + "type": "text/html" + }, + { + "rel": "teaser", + "type": "text/plain" + } + ], + "country": "Deutschland", + "areas": [ + "Rudolstadt und Umgebung" + ], + "city": "Rudolstadt", + "zip": "07407", + "street": "Schulplatz 13", + "phone": "0 36 72 - 48 64 20", + "fax": "0 36 72 - 48 64 30", + "web": "http://www.stadtbibliothek-rudolstadt.de/", + "email": "stadtbibliothek@rudolstadt.de", + "author": "support@hubermedia.de", + "geo": { + "main": { + "latitude": 50.720835175055917, + "longitude": 11.342568397521973 + }, + "entry": [], + "attributes": [] + }, + "ratings": [ + { + "type": "eT4", + "value": 40.0 + }, + { + "type": "order", + "value": 99.0001 + } + ], + "cuisine_types": [], + "payment": [], + "media_objects": [ + ], + "keywords": [], + "timeIntervals": [ + { + "end": "2022-07-10T16:00:00+02:00", + "freq": "Weekly", + "interval": 1, + "repeatUntil": "2022-07-31T16:00:00+02:00", + "start": "2022-07-13T10:00:00+02:00", + "tz": "Europe/Berlin", + "weekdays": [ + "Saturday" + ] + } + ], + "kitchenTimeIntervals": [], + "deliveryTimeIntervals": [], + "numbers": [], + "name": "Stadtbibliothek Rudolstadt", + "attributes": [ + { + "key": "VO_Id", + "value": "100042570" + }, + { + "key": "VO_CategoryName", + "value": "POI" + }, + { + "key": "VA_Id", + "value": "100042570" + }, + { + "key": "VA_CategoryName", + "value": "POI" + }, + { + "key": "interval_first_match_start", + "value": "2099-12-16T15:00:00+01" + }, + { + "key": "interval_first_match_end", + "value": "2099-12-16T16:30:00+01" + }, + { + "key": "interval_match_count", + "value": "3" + }, + { + "key": "interval_last_match_start", + "value": "2022-02-17T15:00:00+01" + }, + { + "key": "interval_last_match_end", + "value": "2022-02-17T17:00:00+01" + } + ], + "features": [ + "vorhandenes Feature", + "Barrierefrei", + "Zielgruppe Jugendliche", + "neues Feature" + ], + "addresses": [ + { + "name": "Städtetourismus in Thüringen e.V.", + "city": "Weimar", + "zip": "99423", + "street": "UNESCO-Platz 1", + "phone": "+49 (3643) 745 314", + "web": "http://www.thueringer-staedte.de", + "email": "verein@thueringer-staedte.de", + "rel": "author" + }, + { + "name": "Städtetourismus in Thüringen\" e.V.", + "web": "http://www.thueringer-staedte.de", + "email": "verein@thueringer-staedte.de", + "rel": "organisation" + }, + { + "name": "Stadtbibliothek Rudolstadt", + "city": "Rudolstadt", + "zip": "07407", + "street": "Schulplatz 13", + "phone": "0 36 72 - 48 64 20", + "fax": "0 36 72 - 48 64 30", + "web": "http://www.stadtbibliothek-rudolstadt.de ", + "email": "stadtbibliothek@rudolstadt.de", + "rel": "organizer" + } + ], + "created": "2099-11-10T23:02:00+00:00", + "changed": "2099-12-14T08:28:00+00:00", + "source": { + "url": "http://destination.one/", + "value": "destination.one" + }, + "company": "", + "district": "", + "postoffice": "", + "phone2": "", + "seasons": [], + "subitems": [], + "hyperObjects": [] + } + ] +} diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithSingleDate.json b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithSingleDate.json new file mode 100644 index 0000000..6d03063 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithSingleDate.json @@ -0,0 +1,111 @@ +{ + "status": "OK", + "count": 3, + "overallcount": 50, + "channels": [], + "facetGroups": [], + "items": [ + { + "global_id": "e_100354481", + "id": "100354481", + "type": "Event", + "country": "Deutschland", + "areas": [ + "Rudolstadt und Umgebung" + ], + "city": "Rudolstadt", + "zip": "07407", + "street": "Schulplatz 13", + "phone": "0 36 72 - 48 64 20", + "fax": "0 36 72 - 48 64 30", + "web": "http://www.stadtbibliothek-rudolstadt.de/", + "email": "stadtbibliothek@rudolstadt.de", + "author": "support@hubermedia.de", + "geo": { + "main": { + "latitude": 50.720835175055917, + "longitude": 11.342568397521973 + }, + "entry": [], + "attributes": [] + }, + "ratings": [ + { + "type": "eT4", + "value": 40.0 + }, + { + "type": "order", + "value": 99.0001 + } + ], + "cuisine_types": [], + "payment": [], + "keywords": [], + "timeIntervals": [ + { + "weekdays": [], + "start": "2022-07-13T15:00:00+02:00", + "end": "2022-07-13T16:30:00+02:00", + "tz": "Europe/Berlin", + "interval": 1 + } + ], + "kitchenTimeIntervals": [], + "deliveryTimeIntervals": [], + "numbers": [], + "name": "Stadtbibliothek Rudolstadt", + "attributes": [ + ], + "features": [ + ], + "addresses": [ + { + "name": "Städtetourismus in Thüringen e.V.", + "city": "Weimar", + "zip": "99423", + "street": "UNESCO-Platz 1", + "phone": "+49 (3643) 745 314", + "web": "http://www.thueringer-staedte.de", + "email": "verein@thueringer-staedte.de", + "rel": "author" + }, + { + "name": "Städtetourismus in Thüringen\" e.V.", + "web": "http://www.thueringer-staedte.de", + "email": "verein@thueringer-staedte.de", + "rel": "organisation" + }, + { + "name": "Stadtbibliothek Rudolstadt", + "city": "Rudolstadt", + "zip": "07407", + "street": "Schulplatz 13", + "phone": "0 36 72 - 48 64 20", + "fax": "0 36 72 - 48 64 30", + "web": "http://www.stadtbibliothek-rudolstadt.de ", + "email": "stadtbibliothek@rudolstadt.de", + "rel": "organizer" + } + ], + "created": "2099-11-10T23:02:00+00:00", + "changed": "2099-12-14T08:28:00+00:00", + "source": { + "url": "http://destination.one/", + "value": "destination.one" + }, + "company": "", + "district": "", + "postoffice": "", + "phone2": "", + "seasons": [], + "subitems": [], + "texts": [ + ], + "title": "Kurzf\u00fchrung - Historische Altstadt", + "type": "Event", + "web": "http://www.erfurt-tourismus.de/stadtfuehrung/individuell/kurzfuehrung-historische-altstadt/", + "zip": "99084" + } + ] +} diff --git a/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php index 99814ed..badef81 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php @@ -18,7 +18,7 @@ class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTest $fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration; GeneralUtility::mkdir_deep($fileImportPath); - $this->setDateAspect(new \DateTimeImmutable('2022-07-01')); + $this->setDateAspect(new \DateTimeImmutable('2022-07-01'), new \DateTimeZone('Europe/Berlin')); $this->importDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Fixtures/SingleRegion.xml'); $this->importDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Fixtures/SingleCategory.xml'); $this->setUpConfiguration([ @@ -52,15 +52,4 @@ class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTest 'Logfile was not empty.' ); } - - private function setDateAspect(\DateTimeImmutable $dateTime): void - { - $context = $this->getContainer()->get(Context::class); - if (!$context instanceof Context) { - throw new \TypeError('Retrieved context was of unexpected type.', 1638182021); - } - - $aspect = new DateTimeAspect($dateTime); - $context->setAspect('date', $aspect); - } } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php new file mode 100644 index 0000000..6e15010 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php @@ -0,0 +1,74 @@ +setUpConfiguration([ + 'restUrl = https://example.com/some-path/', + ]); + $this->importDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Fixtures/FirstDateOfRecurringDatesImportConfiguration.xml'); + $this->setDateAspect(new \DateTimeImmutable('2022-07-13', new \DateTimeZone('UTC'))); + } + + /** + * @test + */ + public function singelDate(): void + { + $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithSingleDate.json') ?: '')]); + + $this->executeCommand(['configurationUid' => '1'], ImportDestinationDataViaConfigruationCommand::class); + + $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv'); + self::assertFileEquals( + __DIR__ . '/Assertions/EmptyLogFile.txt', + $this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log', + 'Logfile was not empty.' + ); + } + + /** + * @test + */ + public function recurringWeekly(): void + { + $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithRecurringWeekly.json') ?: '')]); + + $this->executeCommand(['configurationUid' => '1'], ImportDestinationDataViaConfigruationCommand::class); + + $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv'); + self::assertFileEquals( + __DIR__ . '/Assertions/EmptyLogFile.txt', + $this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log', + 'Logfile was not empty.' + ); + } + + /** + * @test + */ + public function recurringDaily(): void + { + $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithRecurringDaily.json') ?: '')]); + + $this->executeCommand(['configurationUid' => '1'], ImportDestinationDataViaConfigruationCommand::class); + + $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv'); + self::assertFileEquals( + __DIR__ . '/Assertions/EmptyLogFile.txt', + $this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log', + 'Logfile was not empty.' + ); + } +} diff --git a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php index 30b7b31..3c64067 100644 --- a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php @@ -152,12 +152,12 @@ class DatesFactoryTest extends TestCase self::assertCount(3, $result); self::assertInstanceOf(Date::class, $result[0]); - self::assertSame('4078821600', $result[0]->getStart()->format('U')); - self::assertSame('4078825200', $result[0]->getEnd()->format('U')); + self::assertSame('4078735200', $result[0]->getStart()->format('U')); + self::assertSame('4078738800', $result[0]->getEnd()->format('U')); self::assertSame('canceled', $result[0]->getCanceled()); - self::assertSame('4078994400', $result[2]->getStart()->format('U')); - self::assertSame('4078998000', $result[2]->getEnd()->format('U')); + self::assertSame('4078908000', $result[2]->getStart()->format('U')); + self::assertSame('4078911600', $result[2]->getEnd()->format('U')); self::assertSame('canceled', $result[2]->getCanceled()); } @@ -187,12 +187,12 @@ class DatesFactoryTest extends TestCase self::assertCount(3, $result); self::assertInstanceOf(Date::class, $result[0]); - self::assertSame('4078821600', $result[0]->getStart()->format('U')); - self::assertSame('4078825200', $result[0]->getEnd()->format('U')); + self::assertSame('4078735200', $result[0]->getStart()->format('U')); + self::assertSame('4078738800', $result[0]->getEnd()->format('U')); self::assertSame('no', $result[0]->getCanceled()); - self::assertSame('4078994400', $result[2]->getStart()->format('U')); - self::assertSame('4078998000', $result[2]->getEnd()->format('U')); + self::assertSame('4078908000', $result[2]->getStart()->format('U')); + self::assertSame('4078911600', $result[2]->getEnd()->format('U')); self::assertSame('no', $result[2]->getCanceled()); } diff --git a/ext_emconf.php b/ext_emconf.php index ff2572a..973f150 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -9,7 +9,7 @@ $EM_CONF['events'] = [ 'state' => 'alpha', 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '2.4.3', + 'version' => '2.4.4', 'constraints' => [ 'depends' => [ 'typo3' => '10.4.00-11.5.99', diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4538cdd..936d7de 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -28,5 +28,6 @@ +