Bug 19204: Add tests for new days_mode parameter

Sponsored-by: Goethe-Institut

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2018-04-23 10:37:48 -03:00
parent 59b2f2edb9
commit 84f090d195
1 changed files with 14 additions and 1 deletions

View File

@ -25,11 +25,13 @@ use DateTime::Duration;
use Koha::Caches;
use Koha::DateUtils;
use t::lib::Mocks;
use Module::Load::Conditional qw/check_install/;
BEGIN {
if ( check_install( module => 'Test::DBIx::Class' ) ) {
plan tests => 38;
plan tests => 39;
} else {
plan skip_all => "Need Test::DBIx::Class"
}
@ -321,6 +323,17 @@ my $holiday_for_another_branch = DateTime->new(
is ( $cal->is_holiday($holiday_for_another_branch), 1, 'Holiday defined for CPL should be defined as an holiday' );
}
subtest 'days_mode parameter' => sub {
plan tests => 2;
t::lib::Mocks::mock_preference('useDaysMode', 'Days');
my $cal = Koha::Calendar->new( branchcode => 'CPL' );
is( $cal->{days_mode}, 'Days', q|If not set, days_mode defaults to syspref's value|);
$cal = Koha::Calendar->new( branchcode => 'CPL', days_mode => 'Calendar' );
is( $cal->{days_mode}, 'Calendar', q|If set, days_mode is correctly set|);
};
END {
$cache->clear_from_cache( 'single_holidays' ) ;
$cache->clear_from_cache( 'exception_holidays' ) ;