Bugzilla – Attachment 117511 Details for
Bug 25690
SIP should not allow to check out an item in transfer because of a hold to another patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25690: Add SIP2 tests for checking out with holds
Bug-25690-Add-SIP2-tests-for-checking-out-with-hol.patch (text/plain), 3.70 KB, created by
Joonas Kylmälä
on 2021-03-02 13:00:36 UTC
(
hide
)
Description:
Bug 25690: Add SIP2 tests for checking out with holds
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-03-02 13:00:36 UTC
Size:
3.70 KB
patch
obsolete
>From 46e35f39b64be16f1c689f3fb0c465626702695c Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@helsinki.fi> >Date: Thu, 18 Feb 2021 17:37:36 +0200 >Subject: [PATCH] Bug 25690: Add SIP2 tests for checking out with holds > >This should cover whether checking out is allowed for all different >hold states: > >Attached: > - Waiting > - In processing > - Transfer > >Unattached: > - Reserved > >To test: > 1) prove t/db_dependent/SIP/Transaction.t => passes > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/SIP/Transaction.t | 73 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 72 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index ee29265998..6439fe1944 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 => 11; >+use Test::More tests => 12; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -367,6 +367,77 @@ subtest do_checkin => sub { > }; > }; > >+subtest do_checkout_with_holds => 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, >+ } >+ ); >+ >+ my $reserve = AddReserve( >+ { >+ branchcode => $library->branchcode, >+ borrowernumber => $patron2->borrowernumber, >+ biblionumber => $item->biblionumber, >+ } >+ ); >+ >+ 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 attached holds >+ ModReserveAffect( $item->itemnumber, $patron->borrowernumber, 0, $reserve ); # Mark waiting (W) >+ my $hold = Koha::Holds->find($reserve); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to attached hold (W)'); >+ >+ $hold->set_transfer; >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to attached hold (T)'); >+ >+ $hold->set_processing; >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to attached hold (P)'); >+ >+ # Test non-attached holds >+ C4::Reserves::RevertWaitingStatus({ itemnumber => $hold->itemnumber }); >+ t::lib::Mocks::mock_preference('AllowItemsOnHoldCheckoutSIP', '0'); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout refused due to hold and AllowItemsOnHoldCheckoutSIP'); >+ >+ t::lib::Mocks::mock_preference('AllowItemsOnHoldCheckoutSIP', '1'); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 1, 'Checkout allowed due to hold and AllowItemsOnHoldCheckoutSIP'); >+}; >+ > subtest checkin_lost => sub { > plan tests => 2; > >-- >2.11.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 25690
:
116948
|
116949
|
116950
|
116951
|
117000
|
117001
|
117002
|
117003
|
117004
|
117062
|
117063
|
117064
|
117065
|
117066
|
117067
|
117374
|
117507
|
117508
|
117509
|
117510
|
117511
|
117512
|
117513
|
117519
|
117520
|
117521
|
117522
|
117523
|
117524
|
117525
|
117674