Lines 20-26
Link Here
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Benchmark; |
22 |
use Benchmark; |
23 |
use Test::More tests => 7; |
23 |
use Test::More tests => 8; |
24 |
use Test::Deep qw( cmp_methods ); |
24 |
use Test::Deep qw( cmp_methods ); |
25 |
use Test::Exception; |
25 |
use Test::Exception; |
26 |
|
26 |
|
Lines 729-734
subtest 'get_effective_daysmode' => sub {
Link Here
|
729 |
$schema->storage->txn_rollback; |
729 |
$schema->storage->txn_rollback; |
730 |
}; |
730 |
}; |
731 |
|
731 |
|
|
|
732 |
subtest 'get_effective_expire_reserves_charge' => sub { |
733 |
plan tests => 4; |
734 |
|
735 |
$schema->storage->txn_begin; |
736 |
|
737 |
Koha::CirculationRules->search({ rule_name => 'expire_reserves_charge' })->delete; |
738 |
|
739 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 10 ); |
740 |
|
741 |
is( |
742 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
743 |
{ |
744 |
itemtype => undef, |
745 |
branchcode => undef, |
746 |
categorycode => undef, |
747 |
} |
748 |
), |
749 |
'10', |
750 |
'use the default pref value as the circ rule does not exist' |
751 |
); |
752 |
|
753 |
Koha::CirculationRules->set_rule( |
754 |
{ |
755 |
branchcode => '*', |
756 |
categorycode => '*', |
757 |
itemtype => '*', |
758 |
rule_name => 'expire_reserves_charge', |
759 |
rule_value => '20' |
760 |
} |
761 |
); |
762 |
|
763 |
is( |
764 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
765 |
{ |
766 |
categorycode => undef, |
767 |
itemtype => undef, |
768 |
branchcode => undef |
769 |
} |
770 |
), |
771 |
'20', |
772 |
"use the value from the circ rules" |
773 |
); |
774 |
|
775 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 30 ); |
776 |
|
777 |
Koha::CirculationRules->set_rule( |
778 |
{ |
779 |
branchcode => '*', |
780 |
categorycode => '*', |
781 |
itemtype => '*', |
782 |
rule_name => 'expire_reserves_charge', |
783 |
rule_value => undef |
784 |
} |
785 |
); |
786 |
|
787 |
is( |
788 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
789 |
{ |
790 |
categorycode => undef, |
791 |
itemtype => undef, |
792 |
branchcode => undef |
793 |
} |
794 |
), |
795 |
'30', |
796 |
"use the default pref value for as the circ rule has undefined value" |
797 |
); |
798 |
|
799 |
Koha::CirculationRules->set_rule( |
800 |
{ |
801 |
branchcode => '*', |
802 |
categorycode => '*', |
803 |
itemtype => '*', |
804 |
rule_name => 'expire_reserves_charge', |
805 |
rule_value => '0' |
806 |
} |
807 |
); |
808 |
|
809 |
is( |
810 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
811 |
{ |
812 |
categorycode => undef, |
813 |
itemtype => undef, |
814 |
branchcode => undef |
815 |
} |
816 |
), |
817 |
'0', |
818 |
"use the value from the circ rules for even though it's 0" |
819 |
); |
820 |
|
821 |
$schema->storage->txn_rollback; |
822 |
}; |
823 |
|
732 |
subtest 'get_lostreturn_policy() tests' => sub { |
824 |
subtest 'get_lostreturn_policy() tests' => sub { |
733 |
plan tests => 7; |
825 |
plan tests => 7; |
734 |
|
826 |
|
735 |
- |
|
|