Bug 42545: (QA follow-up) Add POD for _init and _holidays and fix incorrect test expectation
The existing 'days: 289 hours, 2 holidays' test asserted 8-1=7 but its own
description named 2 holidays. The expected value matched the buggy behaviour
(loop exiting before the holiday end date) rather than the correct result.
Update to 8-2=6 to reflect the fix.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6ca7c1118b)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
parent
47bb991496
commit
cda9dcf224
|
|
@ -449,6 +449,20 @@ Koha::Calendar - Object containing a branches calendar
|
|||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 _init
|
||||
|
||||
$calendar->_init();
|
||||
|
||||
Populates the object with repeatable closed days (weekly and day/month) for the
|
||||
branch. Called automatically by C<new>.
|
||||
|
||||
=head2 _holidays
|
||||
|
||||
my $holidays = $calendar->_holidays();
|
||||
|
||||
Returns a hashref of special (one-off) holidays for the branch, keyed by
|
||||
C<YYYYMMDD> date strings. Results are cached.
|
||||
|
||||
=head2 new : Create a calendar object
|
||||
|
||||
my $calendar = Koha::Calendar->new( branchcode => 'MAIN' );
|
||||
|
|
|
|||
|
|
@ -612,7 +612,7 @@ subtest 'hours_between | days_between' => sub {
|
|||
$diff_hours = $calendar->hours_between( $now, $nov_13->clone->subtract( hours => 3 ) )->hours;
|
||||
is( $diff_hours, 8 * 24 - 2 * 24 - 3, 'hours: 289 hours, 2 holidays ' );
|
||||
$diff_days = $calendar->days_between( $now, $nov_13->clone->subtract( hours => 3 ) )->delta_days;
|
||||
is( $diff_days, 8 - 1, 'days: 289 hours, 2 holidays' );
|
||||
is( $diff_days, 8 - 2, 'days: 289 hours, 2 holidays' );
|
||||
|
||||
# Between 5th and 15th
|
||||
$diff_hours = $calendar->hours_between( $now, $nov_15->clone->subtract( hours => 3 ) )->hours;
|
||||
|
|
|
|||
Loading…
Reference in New Issue