Bugzilla – Attachment 103294 Details for
Bug 25123
MaxFines does not count the current updating fine
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25123: Unit tests
Bug-25123-Unit-tests.patch (text/plain), 2.52 KB, created by
Jonathan Druart
on 2020-04-20 13:06:02 UTC
(
hide
)
Description:
Bug 25123: Unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-20 13:06:02 UTC
Size:
2.52 KB
patch
obsolete
>From 2893cbd3e10e79a4a59b786a4551446fb2dbf8b2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 13 Apr 2020 11:38:23 +0000 >Subject: [PATCH] Bug 25123: Unit tests > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Overdues.t | 32 +++++++++++++++++++++++++++++++- > 1 file changed, 31 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Overdues.t b/t/db_dependent/Overdues.t >index ab069447ba..5305066f84 100644 >--- a/t/db_dependent/Overdues.t >+++ b/t/db_dependent/Overdues.t >@@ -132,7 +132,7 @@ $schema->storage->txn_rollback; > > subtest 'UpdateFine tests' => sub { > >- plan tests => 59; >+ plan tests => 68; > > $schema->storage->txn_begin; > >@@ -242,6 +242,36 @@ subtest 'UpdateFine tests' => sub { > # Total : Outstanding : MaxFine > # 100 : 100 : 100 > >+ # A day passes, the item is still overdue, update fine is called again >+ # we don't expect to increase above MaxFine of 100 >+ UpdateFine( >+ { >+ issue_id => $checkout2->issue_id, >+ itemnumber => $item2->itemnumber, >+ borrowernumber => $patron->borrowernumber, >+ amount => '40', >+ due => $checkout2->date_due >+ } >+ ); >+ >+ $fines = Koha::Account::Lines->search( >+ { borrowernumber => $patron->borrowernumber }, >+ { order_by => { '-asc' => 'accountlines_id' } } >+ ); >+ is( $fines->count, 2, "Existing fine updated for second checkout, no new fine added" ); >+ $fine = $fines->next; >+ is( $fine->amount+0, 80, "First fine amount unchanged" ); >+ is( $fine->amountoutstanding+0, 80, "First fine amountoutstanding unchanged" ); >+ my $fine2 = $fines->next; >+ is( $fine2->amount+0, 20, "Second fine capped at '20' by MaxFine" ); >+ is( $fine2->amountoutstanding+0, 20, "Second fine amountoutstanding capped at '20' by MaxFine" ); >+ is( $fine2->issue_id, $checkout2->issue_id, "Second fine is associated with the correct issue" ); >+ is( $fine2->itemnumber, $checkout2->itemnumber, "Second fine is associated with the correct item" ); >+ is( $fine->amount + $fine2->amount, '100', "Total fines = 100" ); >+ is( $fine->amountoutstanding + $fine2->amountoutstanding, '100', "Total outstanding = 100" ); >+ # Total : Outstanding : MaxFine >+ # 100 : 100 : 100 >+ > # Partial pay fine 1 > $fine->amountoutstanding(50)->store; > # Total : Outstanding : MaxFine >-- >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 25123
:
102812
|
102813
|
102920
|
103232
|
103233
|
103234
| 103294 |
103295
|
103296