Bugzilla – Attachment 122646 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: [19.11.x] Unit test
Bug-28482-1911x-Unit-test.patch (text/plain), 3.52 KB, created by
Nick Clemens (kidclamp)
on 2021-07-07 11:34:09 UTC
(
hide
)
Description:
Bug 28482: [19.11.x] Unit test
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-07-07 11:34:09 UTC
Size:
3.52 KB
patch
obsolete
>From 9f15737f4d923b1edfaf84d556d2b8027dbb4af4 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: [19.11.x] Unit test > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Fix test rebase >--- > t/db_dependent/Koha/Account/Lines.t | 59 ++++++++++++++++++++++++++++- > 1 file changed, 58 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t >index d63de70938..78526109d9 100755 >--- a/t/db_dependent/Koha/Account/Lines.t >+++ b/t/db_dependent/Koha/Account/Lines.t >@@ -26,6 +26,7 @@ use C4::Circulation qw/AddIssue AddReturn/; > use Koha::Account; > use Koha::Account::Lines; > use Koha::Account::Offsets; >+use Koha::DateUtils; > use Koha::Items; > > use t::lib::Mocks; >@@ -209,7 +210,7 @@ subtest 'is_credit() and is_debit() tests' => sub { > > subtest 'apply() tests' => sub { > >- plan tests => 24; >+ plan tests => 25; > > $schema->storage->txn_begin; > >@@ -319,6 +320,62 @@ subtest 'apply() tests' => sub { > is( $debit_2->discard_changes->amountoutstanding * 1, 0, 'Debit cancelled' ); > is( $debit_3->discard_changes->amountoutstanding * 1, 90, 'Outstanding amount correctly calculated' ); > is( $credit_2->discard_changes->amountoutstanding * 1, 0, 'No remaining credit' ); >+ >+ my $loser = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $loser_account = $loser->account; >+ >+ >+ my $now = dt_from_string(); >+ my $seven_weeks = DateTime::Duration->new(weeks => 7); >+ my $five_weeks = DateTime::Duration->new(weeks => 5); >+ my $seven_weeks_ago = $now - $seven_weeks; >+ my $five_weeks_ago = $now - $five_weeks; >+ >+ 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 => $loser->branchcode, >+ 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 => $loser->branchcode, >+ 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 => $loser->branchcode, >+ 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