From 9f6388066333d36e6ce74fbca3c1fcd78640bf7b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 15 Jul 2020 11:23:38 +0100 Subject: [PATCH] Bug 23091: Outline of tests to be written Signed-off-by: Andrew Fuerste-Henry --- t/db_dependent/Circulation.t | 96 +++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 953992bc9d..871b44541d 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -18,7 +18,7 @@ use Modern::Perl; use utf8; -use Test::More tests => 48; +use Test::More tests => 49; use Test::Exception; use Test::MockModule; use Test::Deep qw( cmp_deeply ); @@ -2345,7 +2345,7 @@ subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { subtest 'AddReturn | is_overdue' => sub { - plan tests => 8; + plan tests => 9; t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'batchmod|moredetail|cronjob|additem|pendingreserves|onpayment'); t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1); @@ -2658,6 +2658,98 @@ subtest 'AddReturn | is_overdue' => sub { Koha::Account::Lines->search( { borrowernumber => $patron->borrowernumber } )->delete; }; + + subtest 'enh 23091 | Lost item return policies' => sub { + plan tests => 1; + + my $branchcode_false = + $builder->build( { source => 'Branch' } )->{branchcode}; + my $specific_rule_false = $builder->build( + { + source => 'CirculationRule', + value => { + branchcode => $branchcode_false, + categorycode => undef, + itemtype => undef, + rule_name => 'lostreturn', + rule_value => 0 + } + } + ); + my $branchcode_refund = + $builder->build( { source => 'Branch' } )->{branchcode}; + my $specific_rule_refund = $builder->build( + { + source => 'CirculationRule', + value => { + branchcode => $branchcode_refund, + categorycode => undef, + itemtype => undef, + rule_name => 'lostreturn', + rule_value => 'refund' + } + } + ); + my $branchcode_restore = + $builder->build( { source => 'Branch' } )->{branchcode}; + my $specific_rule_restore = $builder->build( + { + source => 'CirculationRule', + value => { + branchcode => $branchcode_restore, + categorycode => undef, + itemtype => undef, + rule_name => 'lostreturn', + rule_value => 'restore' + } + } + ); + my $branchcode_charge = + $builder->build( { source => 'Branch' } )->{branchcode}; + my $specific_rule_charge = $builder->build( + { + source => 'CirculationRule', + value => { + branchcode => $branchcode_charge, + categorycode => undef, + itemtype => undef, + rule_name => 'lostreturn', + rule_value => 'charge' + } + } + ); + + t::lib::Mocks::mock_preference( 'BlockReturnOfLostItems', 0 ); + t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' ); + t::lib::Mocks::mock_preference( 'NoRefundOnLostReturnedItemsAge', undef ); + + # Do nothing + # + # Refund fee + ## Without fee + ## With fee + # + # Refund fee and restore fine + ## Without fee + ### Without fine + ### With fine (forgiven) + ### With fine (unforgiven) + ## With fee + ### Without fine + ### With fine (forgiven) + ### With fine (unforgiven) + # + # Refund fee and charge new fine + ## Without fee + ### Without fine + ### With fine (forgiven) + ### With fine (unforgiven) + ## With fee + ### Without fine + ### With fine (forgiven) + ### With fine (unforgiven) + ### Backdated return + }; }; subtest '_RestoreOverdueForLostAndFound' => sub { -- 2.20.1