Bugzilla – Attachment 121479 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), 2.93 KB, created by
Martin Renvoize (ashimema)
on 2021-05-28 12:45:57 UTC
(
hide
)
Description:
Bug 28482: Unit test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-05-28 12:45:57 UTC
Size:
2.93 KB
patch
obsolete
>From 6596cf68705ca2a2e19294c6270d15661d32ade1 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> >--- > 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.20.1
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