Bugzilla – Attachment 102894 Details for
Bug 24380
Add option to recalculate fines upon a backdated return distinctly from `CalculateFinesOnReturn`
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24380 - Unit Test
Bug-24380---Unit-Test.patch (text/plain), 2.31 KB, created by
Martin Renvoize (ashimema)
on 2020-04-14 07:49:57 UTC
(
hide
)
Description:
Bug 24380 - Unit Test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-04-14 07:49:57 UTC
Size:
2.31 KB
patch
obsolete
>From 1422af829c657f3aedc1b4a75a612a1599482e65 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 22 Jan 2020 14:01:14 -0500 >Subject: [PATCH] Bug 24380 - Unit Test > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Circulation/Returns.t | 42 +++++++++++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation/Returns.t b/t/db_dependent/Circulation/Returns.t >index f93ff66945..74ac815a98 100644 >--- a/t/db_dependent/Circulation/Returns.t >+++ b/t/db_dependent/Circulation/Returns.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 6; >+use Test::More tests => 7; > use Test::MockModule; > use Test::Warn; > >@@ -399,4 +399,44 @@ subtest 'BranchTransferLimitsType' => sub { > is( $doreturn, 1, 'AddReturn should have checkin the item if BranchTransferLimitsType=itemtype'); > }; > >+subtest 'Backdated returns should reduce fine if needed' => sub { >+ plan tests => 1; >+ >+ t::lib::Mocks::mock_preference( "CalculateFinesOnReturn", 0 ); >+ >+ my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); >+ my $item = $builder->build_object( >+ { >+ class => 'Koha::Items', >+ value => { >+ biblionumber => $biblio->biblionumber, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ } >+ } >+ ); >+ my $patron = $builder->build_object({class => 'Koha::Patrons'}); >+ my $checkout = AddIssue( $patron->unblessed, $item->barcode ); >+ my $fine = Koha::Account::Line->new({ >+ issue_id => $checkout->id, >+ borrowernumber => $patron->id, >+ itemnumber => $item->id, >+ date => dt_from_string(), >+ amount => 100, >+ amountoutstanding => 100, >+ debit_type_code => 'OVERDUE', >+ status => 'UNRETURNED', >+ timestamp => dt_from_string(), >+ manager_id => undef, >+ interface => 'cli', >+ branchcode => $patron->branchcode, >+ })->store(); >+ >+ my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode, undef, undef, dt_from_string('1999-01-01') ); >+ >+ $fine->discard_changes; >+ is( $fine->amountoutstanding, '0.000000', "Fine was reduced correctly with a backdated return" ); >+}; >+ > $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 24380
:
97055
|
97544
|
97750
|
97751
|
97752
|
99536
|
99537
|
99538
|
102574
|
102575
|
102576
|
102577
|
102894
|
102895
|
102896
|
102981
|
102982
|
102983
|
102984
|
102985