Bugzilla – Attachment 121586 Details for
Bug 28482
Floating point math prevents items from being returned
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28482: Unit test
Bug-28482-Unit-test.patch (text/plain), 3.00 KB, created by
Katrin Fischer
on 2021-06-03 11:23:38 UTC
(
hide
)
Description:
Bug 28482: Unit test
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-06-03 11:23:38 UTC
Size:
3.00 KB
patch
obsolete
>From b8b8d09000876d2c83a160c8586a845316662ce1 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 28 May 2021 12:02:09 +0000 >Subject: [PATCH] Bug 28482: Unit test > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Koha/Account/Line.t | 54 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 53 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index f709c82924..232a56720e 100755 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -175,7 +175,7 @@ subtest 'is_credit() and is_debit() tests' => sub { > > subtest 'apply() tests' => sub { > >- plan tests => 30; >+ plan tests => 31; > > $schema->storage->txn_begin; > >@@ -362,6 +362,58 @@ subtest 'apply() tests' => sub { > is( $messages[0]->payload->{due_date}, 1, 'due_date key in payload' ); > is( $messages[0]->payload->{success}, 1, "'success' key in payload" ); > >+ t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', 'onpayment'); >+ my $loser = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $loser_account = $loser->account; >+ >+ my $lost_item = $builder->build_sample_item(); >+ my $lost_checkout = Koha::Checkout->new( >+ { >+ borrowernumber => $loser->id, >+ itemnumber => $lost_item->id, >+ date_due => $five_weeks_ago, >+ branchcode => $library->id, >+ issuedate => $seven_weeks_ago >+ } >+ )->store(); >+ >+ $lost_item->itemlost(1)->store; >+ my $processing_fee = Koha::Account::Line->new( >+ { >+ issue_id => $lost_checkout->id, >+ borrowernumber => $loser->id, >+ itemnumber => $lost_item->id, >+ branchcode => $library->id, >+ date => \'NOW()', >+ debit_type_code => 'PROCESSING', >+ status => undef, >+ interface => 'intranet', >+ amount => '15', >+ amountoutstanding => '15', >+ } >+ )->store(); >+ my $lost_fee = Koha::Account::Line->new( >+ { >+ issue_id => $lost_checkout->id, >+ borrowernumber => $loser->id, >+ itemnumber => $lost_item->id, >+ branchcode => $library->id, >+ date => \'NOW()', >+ debit_type_code => 'LOST', >+ status => undef, >+ interface => 'intranet', >+ amount => '12.63', >+ amountoutstanding => '12.63', >+ } >+ )->store(); >+ my $pay_lost = $loser_account->add_credit({ amount => 27.630000, user_id => $loser->id, interface => 'intranet' }); >+ my $pay_lines = [ $processing_fee, $lost_fee ]; >+ $pay_lost->apply( { debits => $pay_lines, offset_type => 'Credit applied' } ); >+ >+ is( $loser->checkouts->next, undef, "Item has been returned"); >+ >+ >+ > $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 28482
:
121476
|
121477
|
121479
|
121480
| 121586 |
121587
|
122646
|
122647
|
122659
|
122660