Browse Source

Bug 23012: (follow-up) Fix t/db_dependent/Koha/Items.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Aleisha Amohia 2 years ago
committed by Tomas Cohen Arazi
parent
commit
dfaf5834d1
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 2
      Koha/Item.pm
  2. 33
      t/db_dependent/Koha/Items.t

2
Koha/Item.pm

@ -1325,7 +1325,7 @@ sub _set_found_trigger {
}
}
my $processingreturn_policy = $lost_proc_return_policy->{lostreturn};
my $processingreturn_policy = $lost_proc_return_policy->{processingreturn};
if ( $processingreturn_policy ) {

33
t/db_dependent/Koha/Items.t

@ -368,7 +368,7 @@ subtest 'store' => sub {
subtest 'Full payment tests' => sub {
plan tests => 14;
plan tests => 16;
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
@ -455,6 +455,18 @@ subtest 'store' => sub {
'The account line of type LOST_FOUND has an amountoutstanding of -99'
);
my $processing_return = Koha::Account::Lines->search(
{
itemnumber => $item->itemnumber,
credit_type_code => 'PROCESSING_FOUND'
},
{ rows => 1 }
)->single;
ok( $processing_return, 'An account line of type PROCESSING_FOUND is added' );
is( $processing_return->amount + 0,
-20.00,
'The account line of type PROCESSING_FOUND has an amount of -20' );
$lost_fee_line->discard_changes;
is( $lost_fee_line->amountoutstanding + 0,
0, 'Lost fee has no outstanding amount' );
@ -463,8 +475,8 @@ subtest 'store' => sub {
is( $lost_fee_line->status, 'FOUND',
"Lost fee now has account status of FOUND" );
is( $patron->account->balance, -99,
'The patron balance is -99, a credit that equals the lost fee payment'
is( $patron->account->balance, -119,
'The patron balance is -119, a credit that equals the lost fee payment and the processing fee'
);
};
@ -523,6 +535,21 @@ subtest 'store' => sub {
$replacement_amount,
'The right LOST amountountstanding is generated' );
# Set processingreturn_policy to '0' so processing fee is retained
# these tests are just for lostreturn
my $processingreturn_rule = $builder->build(
{
source => 'CirculationRule',
value => {
branchcode => undef,
categorycode => undef,
itemtype => undef,
rule_name => 'processingreturn',
rule_value => '0'
}
}
);
# Simulate item marked as found
$item->itemlost(0)->store;
is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );

Loading…
Cancel
Save