Skip to content

Commit

Permalink
Add test for previousOpen() overflow issue #243
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jun 24, 2024
1 parent e591278 commit 0818f8d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/OpeningHoursOverflowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@ public function next_close_with_overflow_immutable()
$this->assertSame('2019-04-22 02:00:00', $previousTimeOpen);
}

/** @test */
public function previous_open_and_close_with_overflow_immutable()
{
$openingHours = OpeningHours::create([
'overflow' => true,
'monday' => ['18:00-05:00'],
'tuesday' => ['18:00-05:00'],
]);
$tuesday = new DateTime('2024-06-11 06:00:00');

$this->assertSame('2024-06-10 18:00', $openingHours->previousOpen($tuesday)->format('Y-m-d H:i'));
$this->assertSame('2024-06-11 05:00', $openingHours->previousClose($tuesday)->format('Y-m-d H:i'));
}

/** @test */
public function overflow_on_simple_ranges()
{
Expand Down

0 comments on commit 0818f8d

Please sign in to comment.