Bugzilla – Attachment 166136 Details for
Bug 27753
Automate resolution of return claim when checking in an item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27753: (QA follow-up) Enhance unit tests
Bug-27753-QA-follow-up-Enhance-unit-tests.patch (text/plain), 4.18 KB, created by
Martin Renvoize (ashimema)
on 2024-05-03 14:16:58 UTC
(
hide
)
Description:
Bug 27753: (QA follow-up) Enhance unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-05-03 14:16:58 UTC
Size:
4.18 KB
patch
obsolete
>From 923929b81e0ed0d585246c9561e3c1e852550cbc Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 1 May 2024 12:57:54 +0100 >Subject: [PATCH] Bug 27753: (QA follow-up) Enhance unit tests > >This patch further unit tests highlighting possible issues > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Circulation.t | 26 ++++++++++++++------------ > 1 file changed, 14 insertions(+), 12 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 2e8f3883a64..07ac9248b49 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -2634,14 +2634,16 @@ subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { > > > subtest "Bug 27753 - Add AutoClaimReturnStatusOnCheckin" => sub { >- plan tests => 1; >+ plan tests => 8; > >- t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); >- t::lib::Mocks::mock_userenv( { branchcode => $library2->{branchcode} } ); >+ t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); > t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); > t::lib::Mocks::mock_preference( 'AutoClaimReturnStatusOnCheckin', '' ); >- my $item = $builder->build_sample_item( { library => $library2->{branchcode} } ); >- my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ t::lib::Mocks::mock_preference( 'BlockReturnOfLostItems', 1 ); >+ my $item = $builder->build_sample_item( { library => $library2->{branchcode} } ); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $librarian = $builder->build_object( { class => 'Koha::Patrons' } ); >+ t::lib::Mocks::mock_userenv( { patron => $librarian, branchcode => $library2->{branchcode} } ); > my $future = dt_from_string()->add( days => 7 ); > my $checkout = $builder->build_object( > { >@@ -2665,9 +2667,9 @@ subtest "Bug 27753 - Add AutoClaimReturnStatusOnCheckin" => sub { > notes => "Test note", > } > ); >- is( $claim->issue_id, $checkout->id, "Return claim created for issue" ); >+ is( $claim->issue_id, $checkout->id, "Return claim created for issue" ); > $item->discard_changes; >- is( $item->itemlost, 1, "Item set to lost as 1" ); >+ is( $item->itemlost, 1, "Item set to lost as 1" ); > > # Return tests with feature disabled > my ( $doreturn, $messages ) = AddReturn( $item->barcode, $library->{branchcode} ); >@@ -2675,9 +2677,8 @@ subtest "Bug 27753 - Add AutoClaimReturnStatusOnCheckin" => sub { > ref $messages->{ReturnClaims}, 'Koha::Checkouts::ReturnClaim', > "AddReturn returns message 'ReturnClaims' containing the ReturnClaim object" > ); >- # FIXME: We should reset the checkout here else we hit a 'No patron' defined issue in the AutoClaim code. >- # This might highligt a bug in the code however.. should we allow trigger this code when the return >- # spots that there isn't a current issue >+ $item->discard_changes; >+ is( $item->itemlost, 1, "Item lost status follows BlockReturnOfLostItems prefernce when feature is disabled" ); > > # Now test with the feature enabled > t::lib::Mocks::mock_preference( 'AutoClaimReturnStatusOnCheckin', 'RETURNED_ON_CLAIM' ); >@@ -2687,9 +2688,10 @@ subtest "Bug 27753 - Add AutoClaimReturnStatusOnCheckin" => sub { > "AddReturn returns message 'ClaimAutoResolved' containing the ReturnClaim object" > ); > $claim->discard_changes; >- is( $claim->resolved_by, '', "Claim marked as resolved by '' when AutoClaimReturnStatusOnCheckin set" ); >- # FIXME: The code sets the resolved_by to the patron who was issued the item.. should this be the librarian performing the return instead? >+ is( $claim->resolved_by, $librarian->borrowernumber, "Claim marked as resolved by librarian calling AddReturn when AutoClaimReturnStatusOnCheckin set" ); > is( $claim->resolution, 'RETURNED_ON_CLAIM', "Claim resolution set to match AutoClaimReturnStatusOnCheckin value" ); >+ $item->discard_changes; >+ is( $item->itemlost, 1, "Item lost status follows BlockReturnOfLostItems when feature is enabled" ); > }; > > subtest 'MultipleReserves' => sub { >-- >2.44.0
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 27753
:
162517
|
163058
|
163059
|
163060
|
163061
|
163084
|
163085
|
163090
|
163469
|
163470
|
163474
|
163475
|
163476
|
163477
|
163479
|
163480
|
165911
|
165912
|
165914
|
165915
|
165916
|
165917
|
165918
|
165919
|
165920
|
165952
|
165953
|
165958
|
165959
|
166128
|
166129
|
166130
|
166131
|
166132
|
166133
|
166134
|
166135
| 166136 |
166137