diff --git a/tests/OpeningHoursStructuredDataTest.php b/tests/OpeningHoursStructuredDataTest.php index 662092f..3c582e5 100644 --- a/tests/OpeningHoursStructuredDataTest.php +++ b/tests/OpeningHoursStructuredDataTest.php @@ -68,7 +68,7 @@ public function it_can_render_opening_hours_as_an_array_of_structured_data() $openingHours = OpeningHours::create([ 'monday' => [ - 'hours' => [ + 'hours' => [ '09:00-17:00', ], ], diff --git a/tests/OpeningHoursTest.php b/tests/OpeningHoursTest.php index 3aa696c..3210d3c 100644 --- a/tests/OpeningHoursTest.php +++ b/tests/OpeningHoursTest.php @@ -41,13 +41,13 @@ public function it_can_return_the_opening_hours_for_a_regular_week() public function it_can_return_consecutive_opening_hours_for_a_regular_week() { $openingHours = OpeningHours::create([ - 'monday' => [], - 'tuesday' => ['09:00-18:00'], + 'monday' => [], + 'tuesday' => ['09:00-18:00'], 'wednesday' => ['09:00-18:00'], - 'thursday' => ['09:00-18:00'], - 'friday' => ['09:00-20:00'], - 'saturday' => ['09:00-17:00'], - 'sunday' => [], + 'thursday' => ['09:00-18:00'], + 'friday' => ['09:00-20:00'], + 'saturday' => ['09:00-17:00'], + 'sunday' => [], ]); $openingHoursForWeek = $openingHours->forWeekConsecutiveDays(); @@ -58,13 +58,13 @@ public function it_can_return_consecutive_opening_hours_for_a_regular_week() $this->assertSame('wednesday', array_values($openingHoursForWeek['tuesday']['days'])[1]); $openingHours = OpeningHours::create([ - 'monday' => [], - 'tuesday' => ['09:00-18:00'], + 'monday' => [], + 'tuesday' => ['09:00-18:00'], 'wednesday' => ['09:00-15:00'], - 'thursday' => ['09:00-18:00'], - 'friday' => ['09:00-18:00'], - 'saturday' => ['09:00-15:00'], - 'sunday' => [], + 'thursday' => ['09:00-18:00'], + 'friday' => ['09:00-18:00'], + 'saturday' => ['09:00-15:00'], + 'sunday' => [], ]); $dump = array_map(function ($data) { @@ -72,22 +72,22 @@ public function it_can_return_consecutive_opening_hours_for_a_regular_week() }, $openingHours->forWeekConsecutiveDays()); $this->assertSame([ - 'monday' => 'monday: ', - 'tuesday' => 'tuesday: 09:00-18:00', + 'monday' => 'monday: ', + 'tuesday' => 'tuesday: 09:00-18:00', 'wednesday' => 'wednesday: 09:00-15:00', - 'thursday' => 'thursday, friday: 09:00-18:00', - 'saturday' => 'saturday: 09:00-15:00', - 'sunday' => 'sunday: ', + 'thursday' => 'thursday, friday: 09:00-18:00', + 'saturday' => 'saturday: 09:00-15:00', + 'sunday' => 'sunday: ', ], $dump); $openingHours = OpeningHours::create([ - 'tuesday' => ['09:00-18:00'], + 'tuesday' => ['09:00-18:00'], 'wednesday' => ['09:00-15:00'], - 'thursday' => ['09:00-18:00'], - 'friday' => ['09:00-18:00'], - 'saturday' => ['09:00-15:00'], - 'sunday' => [], - 'monday' => [], + 'thursday' => ['09:00-18:00'], + 'friday' => ['09:00-18:00'], + 'saturday' => ['09:00-15:00'], + 'sunday' => [], + 'monday' => [], ]); $dump = array_map(function ($data) { @@ -95,12 +95,12 @@ public function it_can_return_consecutive_opening_hours_for_a_regular_week() }, $openingHours->forWeekConsecutiveDays()); $this->assertSame([ - 'monday' => 'monday: ', - 'tuesday' => 'tuesday: 09:00-18:00', + 'monday' => 'monday: ', + 'tuesday' => 'tuesday: 09:00-18:00', 'wednesday' => 'wednesday: 09:00-15:00', - 'thursday' => 'thursday, friday: 09:00-18:00', - 'saturday' => 'saturday: 09:00-15:00', - 'sunday' => 'sunday: ', + 'thursday' => 'thursday, friday: 09:00-18:00', + 'saturday' => 'saturday: 09:00-15:00', + 'sunday' => 'sunday: ', ], $dump); } @@ -108,11 +108,11 @@ public function it_can_return_consecutive_opening_hours_for_a_regular_week() public function it_can_return_combined_opening_hours_for_a_regular_week() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], - 'tuesday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], + 'tuesday' => ['09:00-18:00'], 'wednesday' => ['11:00-15:00'], - 'thursday' => ['11:00-15:00'], - 'friday' => ['12:00-14:00'], + 'thursday' => ['11:00-15:00'], + 'friday' => ['12:00-14:00'], ]); $openingHoursForWeek = $openingHours->forWeekCombined(); @@ -123,13 +123,13 @@ public function it_can_return_combined_opening_hours_for_a_regular_week() $this->assertSame('thursday', array_values($openingHoursForWeek['wednesday']['days'])[1]); $openingHours = OpeningHours::create([ - 'monday' => [], - 'tuesday' => ['09:00-18:00'], + 'monday' => [], + 'tuesday' => ['09:00-18:00'], 'wednesday' => ['09:00-15:00'], - 'thursday' => ['09:00-18:00'], - 'friday' => ['09:00-18:00'], - 'saturday' => ['09:00-15:00'], - 'sunday' => [], + 'thursday' => ['09:00-18:00'], + 'friday' => ['09:00-18:00'], + 'saturday' => ['09:00-15:00'], + 'sunday' => [], ]); $dump = array_map(function ($data) { @@ -137,8 +137,8 @@ public function it_can_return_combined_opening_hours_for_a_regular_week() }, $openingHours->forWeekCombined()); $this->assertSame([ - 'monday' => 'monday, sunday: ', - 'tuesday' => 'tuesday, thursday, friday: 09:00-18:00', + 'monday' => 'monday, sunday: ', + 'tuesday' => 'tuesday, thursday, friday: 09:00-18:00', 'wednesday' => 'wednesday, saturday: 09:00-15:00', ], $dump); } @@ -162,7 +162,7 @@ public function it_can_validate_the_opening_hours() public function it_can_return_the_exceptions() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], 'exceptions' => [ '2016-09-26' => [], ], @@ -228,7 +228,7 @@ public function it_can_determine_that_its_regularly_closed_on_a_week_day() public function it_can_return_the_opening_hours_for_a_specific_date() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], 'exceptions' => [ '2016-09-26' => [], ], @@ -293,7 +293,7 @@ public function it_can_determine_that_its_open_at_a_certain_date_and_time() public function it_can_determine_that_its_open_at_a_certain_date_and_time_on_an_exceptional_day() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], 'exceptions' => [ '2016-09-26' => [], ], @@ -312,7 +312,7 @@ public function it_can_determine_that_its_open_at_a_certain_date_and_time_on_an_ public function it_can_determine_that_its_open_at_a_certain_date_and_time_on_an_recurring_exceptional_day() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], 'exceptions' => [ '01-01' => [], '12-25' => ['09:00-12:00'], @@ -351,9 +351,9 @@ public function it_can_prioritize_exceptions_by_giving_full_dates_priority() $openingHours = OpeningHours::create([ 'exceptions' => [ '2018-01-01' => ['09:00-18:00'], - '01-01' => [], - '12-25' => ['09:00-12:00'], - '12-26' => [], + '01-01' => [], + '12-25' => ['09:00-12:00'], + '12-26' => [], ], ]); @@ -378,10 +378,10 @@ public function it_can_prioritize_exceptions_by_giving_full_dates_priority() public function it_can_handle_consecutive_open_hours() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-24:00'], - 'tuesday' => ['00:00-24:00'], + 'monday' => ['09:00-24:00'], + 'tuesday' => ['00:00-24:00'], 'wednesday' => ['00:00-03:00', '09:00-24:00'], - 'friday' => ['00:00-03:00'], + 'friday' => ['00:00-03:00'], ]); $monday = new DateTime('2019-02-04 11:00:00'); @@ -464,7 +464,7 @@ public function it_can_determine_next_open_hours_from_non_working_date_time() public function it_can_determine_next_open_hours_from_edges_time() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], // 2016-09-26 + 'monday' => ['09:00-11:00', '13:00-19:00'], // 2016-09-26 'tuesday' => ['09:00-11:00', '13:00-19:00'], // 2016-09-27 ]); @@ -556,7 +556,7 @@ public function it_can_determine_next_open_hours_from_mixed_structures() 'monday' => [ [ 'hours' => '09:00-11:00', - 'data' => ['foobar'], + 'data' => ['foobar'], ], '13:00-19:00', ], @@ -676,7 +676,7 @@ public function it_can_determine_next_open_hours_from_non_working_date_time_immu public function it_can_determine_next_close_hours_from_non_working_date_time() { $ranges = [ - 'monday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], /* all the default week settings */ 'exceptions' => [ // add non-dynamic exceptions, else let empty @@ -738,7 +738,7 @@ public function it_can_determine_next_close_hours_from_non_working_date_time_imm public function it_can_determine_next_open_hours_from_working_date_time() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], 'tuesday' => ['10:00-11:00', '14:00-19:00'], ]); @@ -752,7 +752,7 @@ public function it_can_determine_next_open_hours_from_working_date_time() public function it_can_determine_next_open_hours_from_working_date_time_immutable() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], 'tuesday' => ['10:00-11:00', '14:00-19:00'], ]); @@ -766,7 +766,7 @@ public function it_can_determine_next_open_hours_from_working_date_time_immutabl public function it_can_determine_next_close_hours_from_working_date_time() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], 'tuesday' => ['10:00-11:00', '14:00-19:00'], ]); @@ -780,7 +780,7 @@ public function it_can_determine_next_close_hours_from_working_date_time() public function it_can_determine_next_close_hours_from_working_date_time_immutable() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], 'tuesday' => ['10:00-11:00', '14:00-19:00'], ]); @@ -794,8 +794,8 @@ public function it_can_determine_next_close_hours_from_working_date_time_immutab public function it_can_determine_next_open_hours_from_early_morning() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], - 'tuesday' => ['10:00-11:00', '14:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], + 'tuesday' => ['10:00-11:00', '14:00-19:00'], 'exceptions' => [ '2016-09-26' => [], ], @@ -811,8 +811,8 @@ public function it_can_determine_next_open_hours_from_early_morning() public function it_can_determine_next_open_hours_from_early_morning_immutable() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], - 'tuesday' => ['10:00-11:00', '14:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], + 'tuesday' => ['10:00-11:00', '14:00-19:00'], 'exceptions' => [ '2016-09-26' => [], ], @@ -828,8 +828,8 @@ public function it_can_determine_next_open_hours_from_early_morning_immutable() public function it_can_determine_next_close_hours_from_early_morning() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], - 'tuesday' => ['10:00-11:00', '14:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], + 'tuesday' => ['10:00-11:00', '14:00-19:00'], 'exceptions' => [ '2016-09-26' => [], ], @@ -845,8 +845,8 @@ public function it_can_determine_next_close_hours_from_early_morning() public function it_can_determine_next_close_hours_from_early_morning_immutable() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-11:00', '13:00-19:00'], - 'tuesday' => ['10:00-11:00', '14:00-19:00'], + 'monday' => ['09:00-11:00', '13:00-19:00'], + 'tuesday' => ['10:00-11:00', '14:00-19:00'], 'exceptions' => [ '2016-09-26' => [], ], @@ -862,7 +862,7 @@ public function it_can_determine_next_close_hours_from_early_morning_immutable() public function it_can_set_the_timezone_on_the_openings_hours_object() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], 'exceptions' => [ '2016-11-14' => ['09:00-13:00'], ], @@ -922,7 +922,7 @@ public function it_can_set_the_timezone_on_the_openings_hours_object() public function it_can_handle_timezone_for_date_string($timezone) { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], ], $timezone); $this->assertFalse($openingHours->isOpenOn('2020-10-20')); $this->assertTrue($openingHours->isOpenOn('2020-10-19')); @@ -942,13 +942,13 @@ public static function timezones(): array public function it_can_determine_that_its_open_now() { $openingHours = OpeningHours::create([ - 'monday' => ['00:00-23:59'], - 'tuesday' => ['00:00-23:59'], + 'monday' => ['00:00-23:59'], + 'tuesday' => ['00:00-23:59'], 'wednesday' => ['00:00-23:59'], - 'thursday' => ['00:00-23:59'], - 'friday' => ['00:00-23:59'], - 'saturday' => ['00:00-23:59'], - 'sunday' => ['00:00-23:59'], + 'thursday' => ['00:00-23:59'], + 'friday' => ['00:00-23:59'], + 'saturday' => ['00:00-23:59'], + 'sunday' => ['00:00-23:59'], ]); $this->assertTrue($openingHours->isOpen()); @@ -982,13 +982,13 @@ public function it_can_determine_that_its_closed_now() public function it_can_retrieve_regular_closing_days_as_strings() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], - 'tuesday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], + 'tuesday' => ['09:00-18:00'], 'wednesday' => ['09:00-18:00'], - 'thursday' => ['09:00-18:00'], - 'friday' => ['09:00-18:00'], - 'saturday' => [], - 'sunday' => [], + 'thursday' => ['09:00-18:00'], + 'friday' => ['09:00-18:00'], + 'saturday' => [], + 'sunday' => [], ]); $this->assertSame(['saturday', 'sunday'], $openingHours->regularClosingDays()); @@ -998,13 +998,13 @@ public function it_can_retrieve_regular_closing_days_as_strings() public function it_can_retrieve_regular_closing_days_as_iso_numbers() { $openingHours = OpeningHours::create([ - 'monday' => ['09:00-18:00'], - 'tuesday' => ['09:00-18:00'], + 'monday' => ['09:00-18:00'], + 'tuesday' => ['09:00-18:00'], 'wednesday' => ['09:00-18:00'], - 'thursday' => ['09:00-18:00'], - 'friday' => ['09:00-18:00'], - 'saturday' => [], - 'sunday' => [], + 'thursday' => ['09:00-18:00'], + 'friday' => ['09:00-18:00'], + 'saturday' => [], + 'sunday' => [], ]); $this->assertSame([6, 7], $openingHours->regularClosingDaysISO()); @@ -1121,13 +1121,13 @@ public function it_throws_an_exception_on_limit_exceeded_full_array_next_open() $this->expectExceptionMessage('No open date/time found in the next 8 days, use $openingHours->setDayLimit() to increase the limit.'); OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], ])->nextOpen(new DateTime('2019-06-06 19:02:00')); } @@ -1138,13 +1138,13 @@ public function it_throws_an_exception_on_limit_exceeded_full_array_previous_ope $this->expectExceptionMessage('No open date/time found in the previous 8 days, use $openingHours->setDayLimit() to increase the limit.'); OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], ])->previousOpen(new DateTime('2019-06-06 19:02:00')); } @@ -1155,13 +1155,13 @@ public function it_throws_an_exception_on_limit_exceeded_full_array_next_open_wi $this->expectExceptionMessage('No open date/time found in the next 366 days, use $openingHours->setDayLimit() to increase the limit.'); OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], - 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], + 'wednesday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], 'exceptions' => [ '2022-09-05' => [], ], @@ -1293,13 +1293,13 @@ public function it_throws_an_exception_on_limit_exceeded_full_array_next_close() $this->expectExceptionMessage('No close date/time found in the next 8 days, use $openingHours->setDayLimit() to increase the limit.'); OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], ])->nextClose(new DateTime('2019-06-06 19:02:00')); } @@ -1310,13 +1310,13 @@ public function it_throws_an_exception_on_limit_exceeded_full_array_previous_clo $this->expectExceptionMessage('No close date/time found in the previous 8 days, use $openingHours->setDayLimit() to increase the limit.'); OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], ])->previousClose(new DateTime('2019-06-06 19:02:00')); } @@ -1324,13 +1324,13 @@ public function it_throws_an_exception_on_limit_exceeded_full_array_previous_clo public function it_should_handle_far_exception() { $this->assertSame('2019-12-25 00:00:00', OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], - 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], + 'wednesday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], 'exceptions' => [ '12-25' => [], ], @@ -1341,13 +1341,13 @@ public function it_should_handle_far_exception() public function it_should_handle_very_far_future_exception_by_changing_limit() { $openingHours = OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], - 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], + 'wednesday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], 'exceptions' => [ '2022-12-25' => [], ], @@ -1361,13 +1361,13 @@ public function it_should_handle_very_far_future_exception_by_changing_limit() public function it_should_handle_very_far_past_exception_by_changing_limit() { $openingHours = OpeningHours::create([ - 'monday' => ['00:00-24:00'], - 'tuesday' => ['00:00-24:00'], - 'wednesday' => ['00:00-24:00'], - 'thursday' => ['00:00-24:00'], - 'friday' => ['00:00-24:00'], - 'saturday' => ['00:00-24:00'], - 'sunday' => ['00:00-24:00'], + 'monday' => ['00:00-24:00'], + 'tuesday' => ['00:00-24:00'], + 'wednesday' => ['00:00-24:00'], + 'thursday' => ['00:00-24:00'], + 'friday' => ['00:00-24:00'], + 'saturday' => ['00:00-24:00'], + 'sunday' => ['00:00-24:00'], 'exceptions' => [ '2013-12-25' => [], ], @@ -1381,13 +1381,13 @@ public function it_should_handle_very_far_past_exception_by_changing_limit() public function it_should_handle_open_range() { $openingHours = OpeningHours::create([ - 'monday' => ['10:00-16:00', '19:30-20:30'], - 'tuesday' => ['22:30-04:00'], + 'monday' => ['10:00-16:00', '19:30-20:30'], + 'tuesday' => ['22:30-04:00'], 'wednesday' => ['07:00-10:00'], - 'thursday' => ['09:00-12:00'], - 'friday' => ['09:00-12:00'], - 'saturday' => [], - 'sunday' => [], + 'thursday' => ['09:00-12:00'], + 'friday' => ['09:00-12:00'], + 'saturday' => [], + 'sunday' => [], ]); $this->assertNull($openingHours->currentOpenRange(new DateTime('2019-07-15 08:00:00'))); @@ -1410,7 +1410,7 @@ public function it_should_handle_open_range() $openingHours = OpeningHours::create([ 'overflow' => true, - 'monday' => ['10:00-16:00', '19:30-02:30'], + 'monday' => ['10:00-16:00', '19:30-02:30'], ]); $this->assertNull($openingHours->currentOpenRange(new DateTime('2020-09-21 18:00'))); @@ -1427,13 +1427,13 @@ public function it_should_handle_open_range() public function it_should_handle_open_start_date_time() { $openingHours = OpeningHours::create([ - 'monday' => ['10:00-16:00', '19:30-20:30'], - 'tuesday' => ['22:30-04:00'], + 'monday' => ['10:00-16:00', '19:30-20:30'], + 'tuesday' => ['22:30-04:00'], 'wednesday' => ['07:00-10:00'], - 'thursday' => ['09:00-12:00'], - 'friday' => ['09:00-12:00'], - 'saturday' => [], - 'sunday' => [], + 'thursday' => ['09:00-12:00'], + 'friday' => ['09:00-12:00'], + 'saturday' => [], + 'sunday' => [], ]); $this->assertNull($openingHours->currentOpenRangeStart(new DateTime('2019-07-15 08:00:00'))); @@ -1452,13 +1452,13 @@ public function it_should_handle_open_start_date_time() public function it_should_handle_open_end_date_time() { $openingHours = OpeningHours::create([ - 'monday' => ['10:00-16:00', '19:30-20:30'], - 'tuesday' => ['22:30-04:00'], + 'monday' => ['10:00-16:00', '19:30-20:30'], + 'tuesday' => ['22:30-04:00'], 'wednesday' => ['07:00-10:00'], - 'thursday' => ['09:00-12:00'], - 'friday' => ['09:00-12:00'], - 'saturday' => [], - 'sunday' => [], + 'thursday' => ['09:00-12:00'], + 'friday' => ['09:00-12:00'], + 'saturday' => [], + 'sunday' => [], ]); $this->assertNull($openingHours->currentOpenRangeEnd(new DateTime('2019-07-15 08:00:00'))); @@ -1481,13 +1481,13 @@ public function it_should_support_empty_arrays_with_merge() 'exceptions' => [ '01-01' => [ 'hours' => [], - 'data' => [ + 'data' => [ 'id' => 'my_id', ], ], '02-02' => [ 'hours' => [], - 'data' => [ + 'data' => [ 'id' => 'my_id', ], ], @@ -1502,13 +1502,13 @@ public function it_should_support_empty_arrays_with_merge() public function it_can_calculate_time_diff() { $openingHours = OpeningHours::create([ - 'monday' => ['10:00-16:00', '19:30-20:30'], - 'tuesday' => ['22:30-04:00'], + 'monday' => ['10:00-16:00', '19:30-20:30'], + 'tuesday' => ['22:30-04:00'], 'wednesday' => ['07:00-10:00'], - 'thursday' => ['09:00-12:00'], - 'friday' => ['09:00-12:00'], - 'saturday' => [], - 'sunday' => [], + 'thursday' => ['09:00-12:00'], + 'friday' => ['09:00-12:00'], + 'saturday' => [], + 'sunday' => [], ]); $this->assertSame(2.0, $openingHours->diffInClosedSeconds(new DateTimeImmutable('Monday 09:59:58'), new DateTimeImmutable('Monday 10:59:58'))); @@ -1565,13 +1565,13 @@ public function testHoursRangeAreKept() public function testSearchWithEmptyHours() { $openingHours = OpeningHours::create([ - 'monday' => [], - 'tuesday' => [], - 'wednesday' => [], - 'thursday' => [], - 'friday' => [], - 'saturday' => [], - 'sunday' => [], + 'monday' => [], + 'tuesday' => [], + 'wednesday' => [], + 'thursday' => [], + 'friday' => [], + 'saturday' => [], + 'sunday' => [], 'exceptions' => [ '2016-11-11' => ['09:00-12:00'], ], @@ -1596,8 +1596,8 @@ public function testRanges() { $openingHours = OpeningHours::create([ 'monday - wednesday' => ['08:30-12:00', '14:30-16:00'], - 'thursday to friday' => ['14:30-18:00'], - 'saturday-sunday' => [], + 'thursday to friday' => ['14:30-18:00'], + 'saturday-sunday' => [], 'exceptions' => [ '2016-11-11-2016-11-14' => ['09:00-12:00'], '11-30-12-01' => ['09:00-14:00'], @@ -1631,7 +1631,7 @@ public function testRangesWeekOverlap() OpeningHours::create([ 'monday - wednesday' => ['08:30-12:00', '14:30-16:00'], - 'tuesday to friday' => ['14:30-18:00'], + 'tuesday to friday' => ['14:30-18:00'], ]); }