Bug 11112: (follow-up) repair Koha::Calendar->add_holiday()
This patch ensures that the package-level cache is updated
when add_holiday() is used. Note that except for the test
case added by this patch, there doesn't seem to be anything
that actually calls ->add_holiday(); it may be better to remove it.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 08c47cbfe2)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
This commit is contained in:
parent
985debedec
commit
e8779ef701
|
|
@ -341,6 +341,7 @@ sub add_holiday {
|
|||
push @dt, $new_dt;
|
||||
$self->{single_holidays} =
|
||||
DateTime::Set->from_datetimes( dates => \@dt );
|
||||
$single_holidays = $self->{single_holidays};
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use DateTime;
|
|||
use DateTime::TimeZone;
|
||||
|
||||
use C4::Context;
|
||||
use Test::More tests => 8;
|
||||
use Test::More tests => 10;
|
||||
|
||||
BEGIN { use_ok('Koha::Calendar'); }
|
||||
BEGIN { use_ok('C4::Calendar'); }
|
||||
|
|
@ -43,3 +43,13 @@ is( $koha_calendar->is_holiday($sunday), 1, 'Sunday is a closed day' );
|
|||
is( $koha_calendar->is_holiday($monday), 0, 'Monday is not a closed day' );
|
||||
is( $koha_calendar->is_holiday($christmas), 1, 'Christmas is a closed day' );
|
||||
is( $koha_calendar->is_holiday($newyear), 1, 'New Years day is a closed day' );
|
||||
|
||||
my $custom_holiday = DateTime->new(
|
||||
year => 2013,
|
||||
month => 11,
|
||||
day => 12,
|
||||
);
|
||||
is( $koha_calendar->is_holiday($custom_holiday), 0, '2013-11-10 does not start off as a holiday' );
|
||||
$koha_calendar->add_holiday($custom_holiday);
|
||||
is( $koha_calendar->is_holiday($custom_holiday), 1, 'able to add holiday for testing' );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue