|
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 656-661
subtest 'get_effective_daysmode' => sub {
Link Here
|
| 656 |
$schema->storage->txn_rollback; |
656 |
$schema->storage->txn_rollback; |
| 657 |
}; |
657 |
}; |
| 658 |
|
658 |
|
|
|
659 |
subtest 'get_effective_expire_reserves_charge' => sub { |
| 660 |
plan tests => 4; |
| 661 |
|
| 662 |
$schema->storage->txn_begin; |
| 663 |
|
| 664 |
Koha::CirculationRules->search({ rule_name => 'expire_reserves_charge' })->delete; |
| 665 |
|
| 666 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 10 ); |
| 667 |
|
| 668 |
is( |
| 669 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
| 670 |
{ |
| 671 |
itemtype => undef, |
| 672 |
branchcode => undef, |
| 673 |
categorycode => undef, |
| 674 |
} |
| 675 |
), |
| 676 |
'10', |
| 677 |
'use the default pref value as the circ rule does not exist' |
| 678 |
); |
| 679 |
|
| 680 |
Koha::CirculationRules->set_rule( |
| 681 |
{ |
| 682 |
branchcode => '*', |
| 683 |
categorycode => '*', |
| 684 |
itemtype => '*', |
| 685 |
rule_name => 'expire_reserves_charge', |
| 686 |
rule_value => '20' |
| 687 |
} |
| 688 |
); |
| 689 |
|
| 690 |
is( |
| 691 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
| 692 |
{ |
| 693 |
categorycode => undef, |
| 694 |
itemtype => undef, |
| 695 |
branchcode => undef |
| 696 |
} |
| 697 |
), |
| 698 |
'20', |
| 699 |
"use the value from the circ rules" |
| 700 |
); |
| 701 |
|
| 702 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 30 ); |
| 703 |
|
| 704 |
Koha::CirculationRules->set_rule( |
| 705 |
{ |
| 706 |
branchcode => '*', |
| 707 |
categorycode => '*', |
| 708 |
itemtype => '*', |
| 709 |
rule_name => 'expire_reserves_charge', |
| 710 |
rule_value => undef |
| 711 |
} |
| 712 |
); |
| 713 |
|
| 714 |
is( |
| 715 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
| 716 |
{ |
| 717 |
categorycode => undef, |
| 718 |
itemtype => undef, |
| 719 |
branchcode => undef |
| 720 |
} |
| 721 |
), |
| 722 |
'30', |
| 723 |
"use the default pref value for as the circ rule has undefined value" |
| 724 |
); |
| 725 |
|
| 726 |
Koha::CirculationRules->set_rule( |
| 727 |
{ |
| 728 |
branchcode => '*', |
| 729 |
categorycode => '*', |
| 730 |
itemtype => '*', |
| 731 |
rule_name => 'expire_reserves_charge', |
| 732 |
rule_value => '0' |
| 733 |
} |
| 734 |
); |
| 735 |
|
| 736 |
is( |
| 737 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
| 738 |
{ |
| 739 |
categorycode => undef, |
| 740 |
itemtype => undef, |
| 741 |
branchcode => undef |
| 742 |
} |
| 743 |
), |
| 744 |
'0', |
| 745 |
"use the value from the circ rules for even though it's 0" |
| 746 |
); |
| 747 |
|
| 748 |
$schema->storage->txn_rollback; |
| 749 |
}; |
| 750 |
|
| 659 |
subtest 'get_lostreturn_policy() tests' => sub { |
751 |
subtest 'get_lostreturn_policy() tests' => sub { |
| 660 |
plan tests => 7; |
752 |
plan tests => 7; |
| 661 |
|
753 |
|
| 662 |
- |
|
|