Bugzilla – Attachment 89514 Details for
Bug 22877
Returning a lost item not marked as returned can generate additional overdue fines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22877: (QA follow-up) Clarify intent of tests and remove one.
Bug-22877-QA-follow-up-Clarify-intent-of-tests-and.patch (text/plain), 5.64 KB, created by
Martin Renvoize
on 2019-05-09 15:36:40 UTC
(
hide
)
Description:
Bug 22877: (QA follow-up) Clarify intent of tests and remove one.
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2019-05-09 15:36:40 UTC
Size:
5.64 KB
patch
obsolete
>From 28bd89ecd7f78e4f09b7b03079e0f2a6590c9c1a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 9 May 2019 16:34:09 +0100 >Subject: [PATCH] Bug 22877: (QA follow-up) Clarify intent of tests and remove > one. > >The intent of these tests as a set were not entirely clear. This patch >clarifies the intent for future developers and removes a superflous one. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Circulation.t | 47 +++++++++++++++++++++--------------- > 1 file changed, 27 insertions(+), 20 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index b84b2d20f9..64c94f2a37 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -1980,7 +1980,7 @@ subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { > > > subtest 'AddReturn | is_overdue' => sub { >- plan tests => 8; >+ plan tests => 7; > > t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1); > t::lib::Mocks::mock_preference('finesMode', 'production'); >@@ -2039,48 +2039,55 @@ subtest 'AddReturn | is_overdue' => sub { > my $ten_days_ago = dt_from_string->subtract( days => 10 ); > $patron = Koha::Patrons->find( $patron->{borrowernumber} ); > >- # No date specify, today will be used >+ # No return date specified, today will be used => 10 days overdue charged > AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago > AddReturn( $item->{barcode}, $library->{branchcode} ); > is( int($patron->account->balance()), 10, 'Patron should have a charge of 10 (10 days x 1)' ); > Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; > >- # specify return date 5 days before => no overdue >+ # specify return date 5 days before => no overdue charged > AddIssue( $patron->unblessed, $item->{barcode}, $five_days_ago ); # date due was 5d ago > AddReturn( $item->{barcode}, $library->{branchcode}, undef, $ten_days_ago ); > is( int($patron->account->balance()), 0, 'AddReturn: pass return_date => no overdue' ); > Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; > >- # specify return date 5 days later => overdue >+ # specify return date 5 days later => 5 days overdue charged > AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago > AddReturn( $item->{barcode}, $library->{branchcode}, undef, $five_days_ago ); > is( int($patron->account->balance()), 5, 'AddReturn: pass return_date => overdue' ); > Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; > >- # specify dropbox date 5 days before => no overdue >- AddIssue( $patron->unblessed, $item->{barcode}, $five_days_ago ); # date due was 5d ago >- AddReturn( $item->{barcode}, $library->{branchcode}, $ten_days_ago ); >- is( int($patron->account->balance()), 0, 'AddReturn: pass return_date => no overdue' ); >- Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; >- >- # specify dropbox date 5 days later => overdue, or... not >+ # specify return date 5 days later, specify exemptfine => no overdue charge > AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago >- AddReturn( $item->{barcode}, $library->{branchcode}, $five_days_ago ); >- is( int($patron->account->balance()), 0, 'AddReturn: pass return_date => no overdue in dropbox mode' ); # FIXME? This is weird, the OVERDUE fine is created ( _CalculateAndUpdateFine > C4::Overdues::UpdateFine ) then remove later (in _FixOverduesOnReturn). Looks like it is a feature >+ AddReturn( $item->{barcode}, $library->{branchcode}, 1, $five_days_ago ); >+ is( int($patron->account->balance()), 0, 'AddReturn: pass return_date => no overdue' ); > Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; > >- # Checkout an item 10 days ago >+ # begin test for bug 22877 > my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago > # Fake fines cronjob on this checkout >- my ( $fine ) = CalcFine( $item , $patron->categorycode, $library->{branchcode}, $ten_days_ago, $now ); >- UpdateFine({ issue_id => $issue->issue_id, itemnumber => $item->{itemnumber}, borrowernumber => $patron->borrowernumber, amount => $fine, due => output_pref($ten_days_ago) }); >- is( int($patron->account->balance()),10, "Overdue fine of 10 days overdue"); >+ my ($fine) = CalcFine( $item, $patron->categorycode, $library->{branchcode}, >+ $ten_days_ago, $now ); >+ UpdateFine( >+ { >+ issue_id => $issue->issue_id, >+ itemnumber => $item->{itemnumber}, >+ borrowernumber => $patron->borrowernumber, >+ amount => $fine, >+ due => output_pref($ten_days_ago) >+ } >+ ); >+ is( int( $patron->account->balance() ), >+ 10, "Overdue fine of 10 days overdue" ); > # Fake longoverdue with charge and not marking returned >- LostItem( $item->{itemnumber}, 'cronjob',0 ); >- is( int($patron->account->balance()),17, "Lost fine of 7 plus 10 days overdue"); >+ LostItem( $item->{itemnumber}, 'cronjob', 0 ); >+ is( int( $patron->account->balance() ), >+ 17, "Lost fine of 7 plus 10 days overdue" ); > # Now we return it today > AddReturn( $item->{barcode}, $library->{branchcode} ); >- is( int($patron->account->balance()),17, "Should have a single 10 days overdue fine and lost charge"); >+ is( int( $patron->account->balance() ), >+ 17, "Should have a single 10 days overdue fine and lost charge" ); >+ # end test for bug 22877 > > }; > >-- >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 22877
:
89505
|
89507
|
89508
|
89509
|
89510
|
89511
|
89512
|
89513
|
89514
|
89516
|
89527
|
89818
|
89819
|
89820
|
89821
|
89858
|
89859
|
89860
|
89861
|
90210
|
90211
|
90212
|
90213