Bugzilla – Attachment 182277 Details for
Bug 39820
Items with hold cancellation requests should have the hold cancelled when checked in via SIP
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39820: (QA follow-up) Unit tests
Bug-39820-QA-follow-up-Unit-tests.patch (text/plain), 3.43 KB, created by
Martin Renvoize (ashimema)
on 2025-05-12 13:50:28 UTC
(
hide
)
Description:
Bug 39820: (QA follow-up) Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-05-12 13:50:28 UTC
Size:
3.43 KB
patch
obsolete
>From 609147915c17538963c3a35b57bd5faa75f8e7e7 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 12 May 2025 14:49:26 +0100 >Subject: [PATCH] Bug 39820: (QA follow-up) Unit tests > >This patch adds unit tests.. but it also adds some FIXME and QUESTION >statements to those tests >--- > t/db_dependent/SIP/Transaction.t | 74 +++++++++++++++++++++++++++++++- > 1 file changed, 73 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index a07033def5b..8482d3c3ce1 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -5,7 +5,7 @@ > > use Modern::Perl; > use Test::NoWarnings; >-use Test::More tests => 21; >+use Test::More tests => 22; > use Test::Warn; > > use DateTime; >@@ -710,6 +710,78 @@ subtest do_checkin => sub { > }; > }; > >+subtest 'cancel_waiting_holds_with_cancellation_requests at checkin' => sub { >+ plan tests => 5; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron1 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode, flags => 1 } ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ # Set up a hold for patron1 >+ my $hold = AddReserve( >+ { >+ branchcode => $library->branchcode, >+ borrowernumber => $patron1->borrowernumber, >+ biblionumber => $item->biblio->biblionumber, >+ itemnumber => $item->itemnumber, >+ } >+ ); >+ >+ # Mark the hold as waiting >+ my $hold_obj = Koha::Holds->find($hold); >+ $hold_obj->update( { found => 'W' } )->store(); >+ >+ # Add a cancellation request for the hold >+ my $cancellation_request = Koha::Hold::CancellationRequest->new( >+ { >+ hold_id => $hold_obj->id, >+ creation_date => \'NOW()', >+ } >+ )->store; >+ >+ is( >+ $item->holds->waiting->filter_by_has_cancellation_requests->count, 1, >+ 'Hold has a cancellation request' >+ ); >+ >+ my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); >+ my $transaction = C4::SIP::ILS::Transaction::Checkin->new(); >+ >+ $transaction->item($sip_item); >+ $transaction->do_checkin( $library->branchcode, C4::SIP::Sip::timestamp ); >+ >+ # Check if the hold still exists >+ $hold_obj = Koha::Holds->find($hold); >+ ok( !defined( $hold_obj ), 'Hold has been cancelled and deleted' ); >+ >+ my $old_hold = Koha::Old::Holds->find($hold); >+ ok( $old_hold, 'Hold was moved to old reserves'); >+ # QUESTION: Should the cancellation reason be set to "Cancelled by SIP"? >+ is( $old_hold->cancellation_reason, undef, 'No cancellation reason was set' ); >+ >+ # FIXME: What should happen to the cancellation request? >+ # Check that the cancellation request is deleted >+ # my $existing_cancellation_requests = Koha::Hold::CancellationRequests->search( { hold_id => $hold } ); >+ # is( $existing_cancellation_requests->count, 0, 'Cancellation request is deleted after processing' ); >+ >+ # Verify the item's hold count >+ is( $item->holds->count, 0, 'No holds remain on the item after cancellation' ); >+}; >+ > subtest do_checkout_with_sysprefs_override => sub { > plan tests => 8; > >-- >2.49.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 39820
:
181999
|
182105
|
182276
| 182277