Bugzilla – Attachment 95992 Details for
Bug 24146
Paying Accruing Fines prior to return causes another accruing fine when returned
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24146: Add test cases
Bug-24146-Add-test-cases.patch (text/plain), 5.79 KB, created by
Martin Renvoize (ashimema)
on 2019-12-04 14:26:50 UTC
(
hide
)
Description:
Bug 24146: Add test cases
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-12-04 14:26:50 UTC
Size:
5.79 KB
patch
obsolete
>From b56b771709263f21455ac6937572ae0cab5bff2f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 4 Dec 2019 14:23:14 +0000 >Subject: [PATCH] Bug 24146: Add test cases > >This patch adds test cases for both checking amountoutstanding values >are handled correctly and also that the paid down accruing fines do not >add additional fines on increment. > >Test plan: >Read the changeset and asses whether the changes/additional tests are >correct as per the expected behaviour. >--- > t/db_dependent/Overdues.t | 42 +++++++++++++++++++++++++++++++++++++-- > 1 file changed, 40 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Overdues.t b/t/db_dependent/Overdues.t >index 85c3502c6a..c83512555b 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 => 25; >+ plan tests => 43; > > $schema->storage->txn_begin; > >@@ -185,6 +185,7 @@ subtest 'UpdateFine tests' => sub { > is( $fines->count, 1, "Fine added when amount is greater than 0" ); > my $fine = $fines->next; > is( $fine->amount, '50.000000', "Fine amount correctly set to 50" ); >+ is( $fine->amountoutstanding, '50.000000', "Fine amountoutstanding correctly set to 50" ); > is( $fine->issue_id, $checkout1->issue_id, "Fine is associated with the correct issue" ); > is( $fine->itemnumber, $checkout1->itemnumber, "Fine is associated with the correct item" ); > >@@ -204,6 +205,7 @@ subtest 'UpdateFine tests' => sub { > is( $fines->count, 1, "Existing fine updated" ); > $fine = $fines->next; > is( $fine->amount, '80.000000', "Fine amount correctly updated to 80" ); >+ is( $fine->amountoutstanding, '80.000000', "Fine amountoutstanding correctly updated to 80" ); > > # Add fine 2 > UpdateFine( >@@ -223,13 +225,15 @@ subtest 'UpdateFine tests' => sub { > is( $fines->count, 2, "New fine added for second checkout" ); > $fine = $fines->next; > is( $fine->amount, '80.000000', "First fine amount unchanged" ); >+ is( $fine->amountoutstanding, '80.000000', "First fine amountoutstanding unchanged" ); > my $fine2 = $fines->next; > is( $fine2->amount, '20.000000', "Second fine capped at '20' by MaxFine" ); >+ is( $fine2->amountoutstanding, '20.000000', "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" ); > > # Partial pay fine 1 >- $fine->amountoutstanding('50')->store; >+ $fine->amountoutstanding('50.000000')->store; > UpdateFine( > { > issue_id => $checkout2->issue_id, >@@ -247,8 +251,10 @@ subtest 'UpdateFine tests' => sub { > is( $fines->count, 2, "Still two fines after second checkout update" ); > $fine = $fines->next; > is( $fine->amount, '80.000000', "First fine amount unchanged" ); >+ is( $fine->amountoutstanding, '50.000000', "First fine amountoutstanding unchanged" ); > $fine2 = $fines->next; > is( $fine2->amount, '30.000000', "Second fine increased after partial payment of first" ); >+ is( $fine2->amountoutstanding, '30.000000', "Second fine amountoutstanding increased after partial payment of first" ); > > # Fix fine 1, create third fine > $fine->status('RETURNED')->store; >@@ -269,10 +275,42 @@ subtest 'UpdateFine tests' => sub { > is( $fines->count, 3, "Third fine added for overdue renewal" ); > $fine = $fines->next; > is( $fine->amount, '80.000000', "First fine amount unchanged" ); >+ is( $fine->amountoutstanding, '50.000000', "First fine amountoutstanding unchanged" ); > $fine2 = $fines->next; > is( $fine2->amount, '30.000000', "Second fine amount unchanged" ); >+ is( $fine2->amountoutstanding, '30.000000', "Second fine amountoutstanding unchanged" ); > my $fine3 = $fines->next; > is( $fine3->amount, '20.000000', "Third fine amount capped due to MaxFine" ); >+ is( $fine3->amountoutstanding, '20.000000', "Third fine amountoutstanding capped at '20' by MaxFine" ); >+ is( $fine3->issue_id, $checkout1->issue_id, "Third fine is associated with the correct issue" ); >+ is( $fine3->itemnumber, $checkout1->itemnumber, "Third fine is associated with the correct item" ); >+ >+ # Payoff accruing fine and ensure next increment doesn't create a new one (bug #24146) >+ $fine3->amountoutstanding('0.000000')->store; >+ UpdateFine( >+ { >+ issue_id => $checkout1->issue_id, >+ itemnumber => $item1->itemnumber, >+ borrowernumber => $patron->borrowernumber, >+ amount => '50', >+ due => $checkout1->date_due >+ } >+ ); >+ >+ $fines = Koha::Account::Lines->search( >+ { borrowernumber => $patron->borrowernumber }, >+ { order_by => { '-asc' => 'accountlines_id' } } >+ ); >+ is( $fines->count, 3, "Still three fines after third checkout update" ); >+ $fine = $fines->next; >+ is( $fine->amount, '80.000000', "First fine amount unchanged" ); >+ is( $fine->amountoutstanding, '50.000000', "First fine amountoutstanding unchanged" ); >+ $fine2 = $fines->next; >+ is( $fine2->amount, '30.000000', "Second fine amount unchanged" ); >+ is( $fine2->amountoutstanding, '30.000000', "Second fine amountoutstanding unchanged" ); >+ $fine3 = $fines->next; >+ is( $fine3->amount, '50.000000', "Third fine amount capped due to MaxFine" ); >+ is( $fine3->amountoutstanding, '20.000000', "Third fine amountoutstanding increased ..." ); > is( $fine3->issue_id, $checkout1->issue_id, "Third fine is associated with the correct issue" ); > is( $fine3->itemnumber, $checkout1->itemnumber, "Third fine is associated with the correct item" ); > >-- >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 24146
:
95992
|
96005
|
96006
|
96065
|
96066
|
96067
|
96068
|
96069
|
96070
|
96071
|
96072
|
97304
|
97305
|
97306
|
97307