Bugzilla – Attachment 165912 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: Follow up with updated unit tests
Bug-27753-Follow-up-with-updated-unit-tests.patch (text/plain), 3.69 KB, created by
Laura Escamilla
on 2024-04-30 15:21:14 UTC
(
hide
)
Description:
Bug 27753: Follow up with updated unit tests
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2024-04-30 15:21:14 UTC
Size:
3.69 KB
patch
obsolete
>From c98fb97631de0407fa66b9a012aff32166047f39 Mon Sep 17 00:00:00 2001 >From: Laura Escamilla <laura.escamilla@bywatersolutions.com> >Date: Tue, 30 Apr 2024 15:01:25 +0000 >Subject: [PATCH] Bug 27753: Follow up with updated unit tests > >--- > t/db_dependent/Circulation.t | 58 +++++++++++++++++++++++++++++++++++- > 1 file changed, 57 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 307db1d8a9..6303e285bd 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 70; >+use Test::More tests => 72; > use Test::Exception; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); >@@ -2632,6 +2632,62 @@ subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { > # TODO There are other tests to provide here > }; > >+subtest "Bug 27753 - Add AutoClaimReturnStatusOnCheckin" => sub { >+ plan tests => 8; >+ t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); >+ t::lib::Mocks::mock_userenv({ branchcode => $library2->{branchcode} }); >+ t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); >+ t::lib::Mocks::mock_preference( 'AutoClaimReturnStatusOnCheckin', 1 ); >+ my $item = $builder->build_sample_item ({library=>$library2->{branchcode}}); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $checkout = AddIssue( $patron, $item->barcode ); >+ >+ my $claim = $checkout->claim_returned( >+ { >+ created_by => $patron->id, >+ notes => "Test note", >+ } >+ ); >+ is( $claim->issue_id, $checkout->id, "Claim issue id matches" ); >+ is( $claim->itemnumber, $item->id, "Claim itemnumber matches" ); >+ is( $claim->borrowernumber, $patron->id, "Claim borrowernumber matches" ); >+ is( $claim->notes, "Test note", "Claim notes match" ); >+ is( $claim->created_by, $patron->id, "Claim created_by matches" ); >+ ok( $claim->created_on, "Claim created_on is set" ); >+ >+ my ( $doreturn, $messages) = AddReturn ( $item->barcode, $library->{branchcode} ); >+ is (ref $messages->{ClaimAutoResolved}, 'Koha::Checkouts::ReturnClaim', "Claim auto resolved upon checkin"); >+ $claim->discard_changes; >+ ok( $claim->resolved_by, "Claim is resolved"); >+}; >+ >+subtest "Bug 27753 - Add AutoTestClaimReturnStatusOnCheckin" => sub { >+ plan tests => 7; >+ t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); >+ t::lib::Mocks::mock_userenv({ branchcode => $library2->{branchcode} }); >+ t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); >+ t::lib::Mocks::mock_preference( 'AutoClaimReturnStatusOnCheckin', 0 ); >+ my $item = $builder->build_sample_item ({library=>$library2->{branchcode}}); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $checkout = AddIssue( $patron, $item->barcode ); >+ >+ my $claim = $checkout->claim_returned( >+ { >+ created_by => $patron->id, >+ notes => "Test note", >+ } >+ ); >+ is( $claim->issue_id, $checkout->id, "Claim issue id matches" ); >+ is( $claim->itemnumber, $item->id, "Claim itemnumber matches" ); >+ is( $claim->borrowernumber, $patron->id, "Claim borrowernumber matches" ); >+ is( $claim->notes, "Test note", "Claim notes match" ); >+ is( $claim->created_by, $patron->id, "Claim created_by matches" ); >+ ok( $claim->created_on, "Claim created_on is set" ); >+ >+ my ( $doreturn, $messages) = AddReturn ( $item->barcode, $library->{branchcode} ); >+ is (ref $messages->{ReturnClaims}, 'Koha::Checkouts::ReturnClaim', "Claim was returned"); >+}; >+ > subtest 'MultipleReserves' => sub { > plan tests => 3; > >-- >2.30.2
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