diff --git a/Classes/Service/DestinationDataImportService/DatesFactory.php b/Classes/Service/DestinationDataImportService/DatesFactory.php index d3cedd1..2eb42fb 100644 --- a/Classes/Service/DestinationDataImportService/DatesFactory.php +++ b/Classes/Service/DestinationDataImportService/DatesFactory.php @@ -45,7 +45,11 @@ class DatesFactory private function isDateSingleDate(array $date): bool { - return empty($date['interval']); + $frequency = $date['freq'] ?? ''; + $start = $date['start'] ?? ''; + + return $frequency === '' + && $start !== ''; } private function isDateInterval(array $date): bool diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json b/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json index 7928034..9c3534d 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Response.json @@ -90,7 +90,8 @@ "weekdays": [], "start": "2099-12-19T15:00:00+01:00", "end": "2099-12-19T16:30:00+01:00", - "tz": "Europe/Berlin" + "tz": "Europe/Berlin", + "interval": 1 } ], "kitchenTimeIntervals": [], @@ -256,7 +257,8 @@ "weekdays": [], "start": "2099-12-16T15:00:00+01:00", "end": "2099-12-16T16:30:00+01:00", - "tz": "Europe/Berlin" + "tz": "Europe/Berlin", + "interval": 1 }, { "weekdays": [], @@ -271,7 +273,8 @@ "weekdays": [], "start": "2099-02-17T15:00:00+01:00", "end": "2099-02-17T17:00:00+01:00", - "tz": "Europe/Berlin" + "tz": "Europe/Berlin", + "interval": 1 } ], "kitchenTimeIntervals": [], @@ -436,7 +439,8 @@ "weekdays": [], "start": "2099-12-01T19:00:00+01:00", "end": "2099-12-01T20:00:00+01:00", - "tz": "Europe/Berlin" + "tz": "Europe/Berlin", + "interval": 1 }, { "weekdays": [ @@ -454,7 +458,8 @@ "weekdays": [], "start": "2099-12-22T19:00:00+01:00", "end": "2099-12-22T20:00:00+01:00", - "tz": "Europe/Berlin" + "tz": "Europe/Berlin", + "interval": 1 } ], "kitchenTimeIntervals": [], diff --git a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php index 6638627..bf3454f 100644 --- a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php @@ -46,18 +46,9 @@ class DatesFactoryTest extends TestCase 'Empty Intervals' => [ 'unkownInput' => [], ], - 'Intervals with interval no repeatUntil' => [ + 'Single interval without values' => [ 'unkownInput' => [ [ - 'interval' => 1, - ], - ], - ], - 'Intervals with interval and repeatUntil bu no freq' => [ - 'unkownInput' => [ - [ - 'interval' => 1, - 'repeatUntil' => 'something', ], ], ], @@ -75,6 +66,7 @@ class DatesFactoryTest extends TestCase 'start' => '2099-06-21T16:00:00+02:00', 'end' => '2099-06-21T22:00:00+02:00', 'tz' => 'Europe/Berlin', + 'interval' => 1, ]], false); self::assertInstanceOf(\Generator::class, $result); @@ -100,6 +92,7 @@ class DatesFactoryTest extends TestCase 'start' => '2099-06-21T16:00:00+02:00', 'end' => '2099-06-21T22:00:00+02:00', 'tz' => 'Europe/Berlin', + 'interval' => 1, ]], true); self::assertInstanceOf(\Generator::class, $result); @@ -258,6 +251,7 @@ class DatesFactoryTest extends TestCase 'start' => '2099-06-21T16:00:00+02:00', 'end' => '2099-06-21T22:00:00+02:00', 'tz' => 'Europe/Berlin', + 'interval' => 1, ], [ 'start' => '2099-04-01T16:00:00+02:00', @@ -304,6 +298,7 @@ class DatesFactoryTest extends TestCase 'start' => '2099-06-21T16:00:00+02:00', 'end' => '2099-06-21T22:00:00+02:00', 'tz' => 'Europe/Berlin', + 'interval' => 1, ], [ 'start' => '2099-04-01T16:00:00+02:00',