Bugzilla – Attachment 102559 Details for
Bug 24159
Allow daysMode for calculating due and renewal dates to be set at the circulation rules level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24159: Add new tests for get_useDaysMode_effective_value
Bug-24159-Add-new-tests-for-getuseDaysModeeffectiv.patch (text/plain), 3.90 KB, created by
PTFS Europe Sandboxes
on 2020-04-08 11:47:55 UTC
(
hide
)
Description:
Bug 24159: Add new tests for get_useDaysMode_effective_value
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2020-04-08 11:47:55 UTC
Size:
3.90 KB
patch
obsolete
>From 35f1290eafbc94ad72e951da7bd08a559ac80449 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 28 Feb 2020 14:49:50 +0100 >Subject: [PATCH] Bug 24159: Add new tests for get_useDaysMode_effective_value > >Sponsored-by: Institute of Technology Carlow > >Signed-off-by: Simon Perry <simon.perry@itcarlow.ie> >--- > t/db_dependent/Koha/CirculationRules.t | 98 +++++++++++++++++++++++++++++++++- > 1 file changed, 96 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/CirculationRules.t b/t/db_dependent/Koha/CirculationRules.t >index 7e27b59feb..d2868d26c8 100644 >--- a/t/db_dependent/Koha/CirculationRules.t >+++ b/t/db_dependent/Koha/CirculationRules.t >@@ -1,6 +1,6 @@ > #!/usr/bin/perl > >-# Copyright 2018 Koha Development team >+# Copyright 2020 Koha Development team > # > # This file is part of Koha > # >@@ -19,13 +19,14 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::Exception; > > use Koha::CirculationRules; > use Koha::Database; > > use t::lib::TestBuilder; >+use t::lib::Mocks; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -282,3 +283,96 @@ subtest 'get_onshelfholds_policy() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'get_useDaysMode_effective_value' => sub { >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $item_1 = $builder->build_sample_item(); >+ my $item_2 = $builder->build_sample_item(); >+ >+ my $circ_rules = >+ Koha::CirculationRules->search( { rule_name => 'useDaysMode' } )->delete; >+ >+ # Default value 'Datedue' at pref level >+ t::lib::Mocks::mock_preference( 'useDaysMode', 'Datedue' ); >+ >+ is( >+ Koha::CirculationRules->get_useDaysMode_effective_value( >+ { >+ categorycode => undef, >+ itemtype => $item_1->effective_itemtype, >+ branchcode => undef >+ } >+ ), >+ 'Datedue', >+ 'useDaysMode default to pref value if the rule does not exist' >+ ); >+ >+ Koha::CirculationRules->set_rule( >+ { >+ branchcode => '*', >+ categorycode => '*', >+ itemtype => '*', >+ rule_name => 'useDaysMode', >+ rule_value => 'Calendar', >+ } >+ ); >+ Koha::CirculationRules->set_rule( >+ { >+ branchcode => '*', >+ categorycode => '*', >+ itemtype => $item_1->effective_itemtype, >+ rule_name => 'useDaysMode', >+ rule_value => 'Days', >+ } >+ ); >+ >+ is( >+ Koha::CirculationRules->get_useDaysMode_effective_value( >+ { >+ categorycode => undef, >+ itemtype => $item_1->effective_itemtype, >+ branchcode => undef >+ } >+ ), >+ 'Days', >+ "useDaysMode for item_1 is the specific rule" >+ ); >+ is( >+ Koha::CirculationRules->get_useDaysMode_effective_value( >+ { >+ categorycode => undef, >+ itemtype => $item_2->effective_itemtype, >+ branchcode => undef >+ } >+ ), >+ 'Calendar', >+ "useDaysMode for item_2 is the one defined for the default circ rule" >+ ); >+ >+ Koha::CirculationRules->set_rule( >+ { >+ branchcode => '*', >+ categorycode => '*', >+ itemtype => $item_2->effective_itemtype, >+ rule_name => 'useDaysMode', >+ rule_value => '', >+ } >+ ); >+ >+ is( >+ Koha::CirculationRules->get_useDaysMode_effective_value( >+ { >+ categorycode => undef, >+ itemtype => $item_2->effective_itemtype, >+ branchcode => undef >+ } >+ ), >+ 'Datedue', >+ 'useDaysMode default to pref value if the rule exists but set to""' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24159
:
99758
|
99759
|
99760
|
99761
|
99762
|
100608
|
100609
|
100610
|
100611
|
100612
|
100613
|
100614
|
100615
|
101053
|
101054
|
101556
|
101649
|
101698
|
102009
|
102148
|
102303
|
102554
|
102555
|
102556
|
102557
|
102558
|
102559
|
102560
|
102561
|
102562
|
102563
|
104197
|
104198
|
104199
|
104200
|
104201
|
104202
|
104203
|
104204
|
106007
|
106008
|
106013
|
106014
|
106015
|
106016
|
106017
|
106018
|
106019
|
106020
|
106021
|
106022