Bugzilla – Attachment 156154 Details for
Bug 34016
Enable fulfillment of recalled items through SIP2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34016: Tests for fulfilling recalls via SIP
Bug-34016-Tests-for-fulfilling-recalls-via-SIP.patch (text/plain), 4.75 KB, created by
Tomás Cohen Arazi
on 2023-09-25 12:52:33 UTC
(
hide
)
Description:
Bug 34016: Tests for fulfilling recalls via SIP
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2023-09-25 12:52:33 UTC
Size:
4.75 KB
patch
obsolete
>From da638b0cb10ef588bad8603b9c8eed982a2c9a7c Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 15 Jun 2023 17:21:21 +1200 >Subject: [PATCH] Bug 34016: Tests for fulfilling recalls via SIP > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/SIP/Transaction.t | 107 ++++++++++++++++++++++++++++++- > 1 file changed, 106 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index 232e6456a58..7703330314d 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,7 +4,7 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 17; >+use Test::More tests => 18; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -22,6 +22,7 @@ use C4::Reserves qw( AddReserve ModReserve ModReserveAffect RevertWaitingStatus > use Koha::CirculationRules; > use Koha::Item::Transfer; > use Koha::DateUtils qw( dt_from_string output_pref ); >+use Koha::Recalls; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -1043,4 +1044,108 @@ subtest item_circulation_status => sub { > is( $status, '01', "Item circulation status is damaged" ); > $item->damaged(0)->store(); > }; >+ >+subtest do_checkout_with_recalls => sub { >+ plan tests => 7; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ my $patron2 = $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, >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); >+ Koha::CirculationRules->set_rule( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => undef, >+ rule_name => 'recalls_allowed', >+ rule_value => '10', >+ } >+ ); >+ >+ my $recall1 = Koha::Recall->new( >+ { >+ patron_id => $patron2->borrowernumber, >+ created_date => \'NOW()', >+ biblio_id => $item->biblio->biblionumber, >+ pickup_library_id => $library->branchcode, >+ item_id => $item->itemnumber, >+ expiration_date => undef, >+ item_level => 1 >+ } >+ )->store; >+ >+ my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); >+ my $co_transaction = C4::SIP::ILS::Transaction::Checkout->new(); >+ is( >+ $co_transaction->patron($sip_patron), >+ $sip_patron, "Patron assigned to transaction" >+ ); >+ is( >+ $co_transaction->item($sip_item), >+ $sip_item, "Item assigned to transaction" >+ ); >+ >+ # Test recalls made by another patron >+ >+ $recall1->set_waiting( { item => $item } ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to waiting recall' ); >+ >+ $recall1->revert_waiting; >+ $recall1->start_transfer( { item => $item } ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to recall in transit' ); >+ >+ $recall1->revert_transfer; >+ $recall1->update( { item_id => undef, item_level => 0 } ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to a biblio-level recall that this item could fill' ); >+ >+ $recall1->set_cancelled; >+ >+ my $recall2 = Koha::Recall->new( >+ { >+ patron_id => $patron->borrowernumber, >+ created_date => \'NOW()', >+ biblio_id => $item->biblio->biblionumber, >+ pickup_library_id => $library->branchcode, >+ item_id => $item->itemnumber, >+ expiration_date => undef, >+ item_level => 1 >+ } >+ )->store; >+ >+ # Test recalls made by SIP patron >+ >+ $recall2->set_waiting( { item => $item } ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 1, 'Checkout was done because recalled item was allocated to them' ); >+ $recall2 = Koha::Recalls->find( $recall2->id ); >+ is( $recall2->status, 'fulfilled', 'Recall is fulfilled by checked out item' ); >+}; >+ > $schema->storage->txn_rollback; >-- >2.42.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 34016
:
152371
|
152372
|
152396
|
152397
|
152458
|
152461
|
152462
|
155382
|
155383
|
155471
| 156154 |
156155