From 5b4a5712d40b741ee8a5bb644f89ec392e6389a0 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Wed, 8 Jan 2020 14:20:38 +0100 Subject: [PATCH] Bug 22806: Unit Tests --- t/db_dependent/ILSDI_Services.t | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t index 430d900c77..4a5723dc00 100644 --- a/t/db_dependent/ILSDI_Services.t +++ b/t/db_dependent/ILSDI_Services.t @@ -302,7 +302,7 @@ subtest 'LookupPatron test' => sub { subtest 'Holds test' => sub { - plan tests => 5; + plan tests => 7; $schema->storage->txn_begin; @@ -418,6 +418,7 @@ subtest 'Holds test' => sub { source => 'Item', value => { biblionumber => $biblio3->{biblionumber}, + barcode => '123456789', damaged => 0, } }); @@ -448,6 +449,19 @@ subtest 'Holds test' => sub { $reply = C4::ILSDI::Services::HoldItem( $query ); is( $reply->{code}, 'damaged', "Item is damaged" ); + t::lib::Mocks::mock_preference( 'AllowHoldsOnPatronsPossessions', '0' ); + + my $mock_patron = $builder->build_object( { class => 'Koha::Patrons' } ); + t::lib::Mocks::mock_userenv( { patron => $mock_patron } ); # For AddIssue + my $checkout = C4::Circulation::AddIssue( $mock_patron->unblessed, $item->{barcode} ); + + $query->param( 'patron_id', $mock_patron->borrowernumber); + $query->param( 'bib_id', $biblio3->{biblionumber}); + $query->param( 'item_id', $item3->{itemnumber}); + $reply = C4::ILSDI::Services::HoldItem( $query ); + is( $reply->{code}, 'itemAlreadyOnLoan', "Patron has issued same book" ); + is( $reply->{pickup_location}, undef, "No reserve placed"); + $schema->storage->txn_rollback; }; -- 2.20.1