Skip to content

Commit c3bf10d

Browse files
Merge pull request #19 from mikemand/hotfix/fix-is-closed-on
Fix `isClosedOn` mirroring `isOpenOn` instead of being the opposite
2 parents 922fcbe + a45502a commit c3bf10d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/OpeningHours.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function isOpenOn(string $day): bool
9292

9393
public function isClosedOn(string $day): bool
9494
{
95-
return $this->isOpenOn($day);
95+
return ! $this->isOpenOn($day);
9696
}
9797

9898
public function isOpenAt(DateTimeInterface $dateTime): bool

tests/OpeningHoursTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ public function it_can_determine_that_its_regularly_open_on_a_week_day()
6868
$this->assertFalse($openingHours->isOpenOn('tuesday'));
6969
}
7070

71+
/** @test */
72+
public function it_can_determine_that_its_regularly_closed_on_a_week_day()
73+
{
74+
$openingHours = OpeningHours::create([
75+
'monday' => ['09:00-18:00'],
76+
]);
77+
78+
$this->assertFalse($openingHours->isClosedOn('monday'));
79+
$this->assertTrue($openingHours->isClosedOn('tuesday'));
80+
}
81+
7182
/** @test */
7283
public function it_can_return_the_opening_hours_for_a_specific_date()
7384
{

0 commit comments

Comments
 (0)