Bugzilla – Attachment 96005 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), 7.47 KB, created by
Martin Renvoize (ashimema)
on 2019-12-05 09:53:34 UTC
(
hide
)
Description:
Bug 24146: Add test cases
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-12-05 09:53:34 UTC
Size:
7.47 KB
patch
obsolete
>From 492dbf77cea2eb4688840668096c07405d3a2e7b 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 | 74 +++++++++++++++++++++++++++++++++++---- > 1 file changed, 68 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Overdues.t b/t/db_dependent/Overdues.t >index 85c3502c6a..7340cb664c 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; > >@@ -168,8 +168,10 @@ subtest 'UpdateFine tests' => sub { > my $fines = Koha::Account::Lines->search( > { borrowernumber => $patron->borrowernumber } ); > is( $fines->count, 0, "No fine added when amount is 0" ); >+ # Total : Outstanding : MaxFine >+ # 0 : 0 : 100 > >- # Add fine 1 >+ # Add fine 1 - First Item Overdue > UpdateFine( > { > issue_id => $checkout1->issue_id, >@@ -185,10 +187,13 @@ 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" ); >+ # Total : Outstanding : MaxFine >+ # 50 : 50 : 100 > >- # Increase fine 1 >+ # Increase fine 1 - First Item Overdue > UpdateFine( > { > issue_id => $checkout1->issue_id, >@@ -204,8 +209,11 @@ 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" ); >+ # Total : Outstanding : MaxFine >+ # 80 : 80 : 100 > >- # Add fine 2 >+ # Add fine 2 - Second Item Overdue > UpdateFine( > { > issue_id => $checkout2->issue_id, >@@ -223,13 +231,21 @@ 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" ); >+ # Total : Outstanding : MaxFine >+ # 100 : 100 : 100 > > # Partial pay fine 1 >- $fine->amountoutstanding('50')->store; >+ $fine->amountoutstanding('50.000000')->store; >+ # Total : Outstanding : MaxFine >+ # 100 : 50 : 100 >+ >+ # Increase fine 2 - Second item overdue > UpdateFine( > { > issue_id => $checkout2->issue_id, >@@ -247,11 +263,17 @@ 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" ); >+ # Total : Outstanding : MaxFine >+ # 110 : 80 : 100 > >- # Fix fine 1, create third fine >+ # Fix fine 1 - First item renewed > $fine->status('RETURNED')->store; >+ >+ # Add fine 3 - First item second overdue > UpdateFine( > { > issue_id => $checkout1->issue_id, >@@ -269,13 +291,53 @@ 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" ); >+ # Total : Outstanding : MaxFine >+ # 130 : 100 : 100 >+ >+ # Payoff accruing fine and ensure next increment doesn't create a new one (bug #24146) >+ $fine3->amountoutstanding('0')->store; >+ # Total : Outstanding : MaxFine >+ # 130 : 80 : 100 >+ >+ # Increase fine 3 - First item, second overdue increase >+ 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" ); >+ # Total : Outstanding : MaxFine >+ # 160 : 100 : 100 >+ > # FIXME: Add test to check whether sundry/manual charges are included within MaxFine. > # FIXME: Add test to ensure other charges are not included within 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 24146
:
95992
|
96005
|
96006
|
96065
|
96066
|
96067
|
96068
|
96069
|
96070
|
96071
|
96072
|
97304
|
97305
|
97306
|
97307