toHaveCount(8) ->and(UkBankHolidays::forYear(2025))->toHaveCount(8); }); it('computes Easter Monday correctly for 2024 (Apr 1)', function () { $dates = array_map(fn ($d): string => $d->toDateString(), UkBankHolidays::forYear(2024)); expect($dates)->toContain('2024-04-01'); // Easter Monday expect($dates)->toContain('2024-03-29'); // Good Friday }); it('computes the floating Mondays for 2024 correctly', function () { $dates = array_map(fn ($d): string => $d->toDateString(), UkBankHolidays::forYear(2024)); expect($dates)->toContain('2024-05-06'); // First Mon of May (Early May) expect($dates)->toContain('2024-05-27'); // Last Mon of May (Spring) expect($dates)->toContain('2024-08-26'); // Last Mon of August (Summer) }); it('substitutes Christmas Day forward when it falls on a weekend (2022)', function () { // 2022: Christmas was a Sunday, Boxing Day Monday → Christmas observed Tue Dec 27, Boxing observed Mon Dec 26. $dates = array_map(fn ($d): string => $d->toDateString(), UkBankHolidays::forYear(2022)); expect($dates)->toContain('2022-12-26') // Boxing ->and($dates)->toContain('2022-12-27'); // Christmas substituted }); it('returns true when a target Monday is itself a bank holiday (Easter Monday 2024)', function () { $monday = Carbon::parse('2024-04-01'); expect(UkBankHolidays::holidayWithin($monday, 7))->toBeTrue(); }); it('returns true when a bank holiday falls within the next 7 days', function () { // Mon 2024-04-01 is Easter Monday. The Monday before (2024-03-25) is pre-bank-holiday week. $weekBefore = Carbon::parse('2024-03-25'); expect(UkBankHolidays::holidayWithin($weekBefore, 7))->toBeTrue(); }); it('returns false for a quiet stretch with no holidays in the window', function () { // Mid-July 2024 — no UK bank holidays in this 7-day window. $monday = Carbon::parse('2024-07-15'); expect(UkBankHolidays::holidayWithin($monday, 7))->toBeFalse(); }); it('handles a window that crosses a year boundary', function () { // Mon 2024-12-30 → window includes New Year's Day 2025 (Wed Jan 1). $monday = Carbon::parse('2024-12-30'); expect(UkBankHolidays::holidayWithin($monday, 7))->toBeTrue(); });