Bugzilla – Attachment 172269 Details for
Bug 33292
Claim return doesn't refund lost item charge when MarkLostItemsAsReturned includes "When marking an item as a return claim" and "Refund lost item fee" is on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33292: Add unit tests
Bug-33292-Add-unit-tests.patch (text/plain), 4.79 KB, created by
PTFS Europe Sandboxes
on 2024-10-01 13:43:02 UTC
(
hide
)
Description:
Bug 33292: Add unit tests
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2024-10-01 13:43:02 UTC
Size:
4.79 KB
patch
obsolete
>From f515220e0c9d44be8a225b3498959dbe95f859d6 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Thu, 26 Sep 2024 13:00:26 +0000 >Subject: [PATCH] Bug 33292: Add unit tests > >Test plan: >1) In KTD, set ClaimReturnedLostValue to any value >2) Checkout an item to a patron >3) Add a manual invoice to that patron's account against that item barcode >4) In the patron's checkouts table, click the Claim returned button >5) The checkbox will have the option to "Refund previous lost fee" >6) Tick this box and submit >7) Have a look at the patron's transactions. There will now be a new line refunding the lost fee from step 3 >8) Run the unit tests >prove t/db_dependent/Circulation/ReturnClaims.t >prove t/db_dependent/api/v1/return_claims.t > >Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> >--- > t/db_dependent/Circulation/ReturnClaims.t | 42 ++++++++++++++++++++++- > t/db_dependent/api/v1/return_claims.t | 3 ++ > 2 files changed, 44 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation/ReturnClaims.t b/t/db_dependent/Circulation/ReturnClaims.t >index 2bb2a5c437..e1b4409f6e 100755 >--- a/t/db_dependent/Circulation/ReturnClaims.t >+++ b/t/db_dependent/Circulation/ReturnClaims.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > use Test::MockModule; > use Test::Warn; > >@@ -143,6 +143,46 @@ subtest 'Test Koha::Checkout::claim_returned, mark as returned' => sub { > is( $checkout2->id, $checkout->id, "Checkout was found in the old_issues table"); > }; > >+subtest 'Test Koha::Checkout::claim_returned, should refund a previous lost fee if refund_lost_fee is set' => sub { >+ plan tests => 4; >+ >+ t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); >+ t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', q{claim_returned} ); >+ my $item = $builder->build_sample_item; >+ my $itemnumber = $item->itemnumber; >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $checkout = AddIssue( $patron, $item->barcode ); >+ >+ my $line = Koha::Account::Line->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ itemnumber => $itemnumber, >+ debit_type_code => "LOST", >+ status => "NULL", >+ amount => 10, >+ amountoutstanding => 10, >+ interface => 'commandline', >+ } >+ )->store; >+ >+ my $claim = $checkout->claim_returned( >+ { >+ created_by => $patron->borrowernumber, >+ notes => "Test note", >+ refund_lost_fee => 1 >+ } >+ ); >+ >+ my $updated_line = Koha::Account::Lines->find( { accountlines_id => $line->accountlines_id } ); >+ is( $updated_line->amountoutstanding + 0, 0, "Line amount outstanding is 0" ); >+ is( $updated_line->status, 'FOUND', "Line has been struck off as 'FOUND'" ); >+ >+ my $credit = >+ Koha::Account::Lines->find( { borrowernumber => $patron->borrowernumber, credit_type_code => 'LOST_FOUND' } ); >+ is( $credit->amount + 0, -10, "Credit amount is 10" ); >+ is( $credit->description, "Item found $itemnumber", "Credit has been marked as relating to the item being found" ); >+}; >+ > subtest 'Test Koha::Checkout::claim_returned should not update the itemlost status if it is already set' => sub { > plan tests => 2; > >diff --git a/t/db_dependent/api/v1/return_claims.t b/t/db_dependent/api/v1/return_claims.t >index a79dd9e73f..a151cee26d 100755 >--- a/t/db_dependent/api/v1/return_claims.t >+++ b/t/db_dependent/api/v1/return_claims.t >@@ -72,6 +72,7 @@ subtest 'claim_returned() tests' => sub { > "//$userid:$password@/api/v1/return_claims" => json => { > item_id => $item->itemnumber, > charge_lost_fee => Mojo::JSON->false, >+ refund_lost_fee => Mojo::JSON->false, > created_by => $librarian->id, > notes => "This is a test note." > } >@@ -88,6 +89,7 @@ subtest 'claim_returned() tests' => sub { > "//$userid:$password@/api/v1/return_claims" => json => { > item_id => $item->itemnumber, > charge_lost_fee => Mojo::JSON->false, >+ refund_lost_fee => Mojo::JSON->false, > created_by => $librarian->id, > notes => "This is a test note." > } >@@ -101,6 +103,7 @@ subtest 'claim_returned() tests' => sub { > "//$userid:$password@/api/v1/return_claims" => json => { > item_id => $item->itemnumber, > charge_lost_fee => Mojo::JSON->false, >+ refund_lost_fee => Mojo::JSON->false, > created_by => $librarian->id, > notes => "This is a test note." > } >-- >2.39.5
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 33292
:
171966
|
171967
|
171968
|
172269
|
172270
|
172271
|
172673
|
172674
|
172675