From 50592a1b265b656ef1d4fa679c54fee46f654348 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 28 Feb 2020 14:28:33 +0100 Subject: [PATCH] Bug 24159: Adjust tests Sponsored-by: Institute of Technology Carlow Signed-off-by: Simon Perry Signed-off-by: Martin Renvoize --- t/Calendar.t | 33 ++++----------------------------- t/db_dependent/Calendar.t | 2 +- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/t/Calendar.t b/t/Calendar.t index e390696a44..b3dc02ffaf 100755 --- a/t/Calendar.t +++ b/t/Calendar.t @@ -207,15 +207,7 @@ my $holiday_for_another_branch = DateTime->new( { ## 'Datedue' tests - $module_context->unmock('preference'); - $module_context->mock( - 'preference', - sub { - return 'Datedue'; - } - ); - - $cal = Koha::Calendar->new( branchcode => 'MPL' ); + $cal = Koha::Calendar->new( branchcode => 'MPL', days_mode => 'Datedue' ); is($cal->addDate( $dt, $one_day_dur, 'days' ), # tuesday dt_from_string('2012-07-05','iso'), @@ -246,15 +238,7 @@ my $holiday_for_another_branch = DateTime->new( { ## 'Calendar' tests' - $module_context->unmock('preference'); - $module_context->mock( - 'preference', - sub { - return 'Calendar'; - } - ); - - $cal = Koha::Calendar->new( branchcode => 'MPL' ); + $cal = Koha::Calendar->new( branchcode => 'MPL', days_mode => 'Calendar' ); $dt = dt_from_string('2012-07-03','iso'); @@ -281,15 +265,8 @@ my $holiday_for_another_branch = DateTime->new( { ## 'Days' tests - $module_context->unmock('preference'); - $module_context->mock( - 'preference', - sub { - return 'Days'; - } - ); - $cal = Koha::Calendar->new( branchcode => 'MPL' ); + $cal = Koha::Calendar->new( branchcode => 'MPL', days_mode => 'Days' ); $dt = dt_from_string('2012-07-03','iso'); @@ -324,11 +301,9 @@ my $holiday_for_another_branch = DateTime->new( } subtest 'days_mode parameter' => sub { - plan tests => 2; + plan tests => 1; 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|); diff --git a/t/db_dependent/Calendar.t b/t/db_dependent/Calendar.t index 0cd6f2a063..220f81f122 100644 --- a/t/db_dependent/Calendar.t +++ b/t/db_dependent/Calendar.t @@ -52,7 +52,7 @@ my $holiday = $builder->build( } ); -my $calendar = Koha::Calendar->new( branchcode => $library->branchcode ); +my $calendar = Koha::Calendar->new( branchcode => $library->branchcode, days_mode => 'Calendar' ); subtest 'days_forward' => sub { -- 2.20.1