@@ -, +, @@ --- t/db_dependent/HoldsQueue.t | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) --- a/t/db_dependent/HoldsQueue.t +++ a/t/db_dependent/HoldsQueue.t @@ -2095,7 +2095,7 @@ subtest "GetItemsAvailableToFillHoldsRequestsForBib" => sub { subtest 'Remove item from holds queue on checkout' => sub { - plan tests => 2; + plan tests => 4; $schema->storage->txn_begin; @@ -2115,6 +2115,7 @@ subtest 'Remove item from holds queue on checkout' => sub { ); my $item = $builder->build_sample_item( { homebranch => $lib->branchcode, holdingbranch => $lib->branchcode } ); + my $item2 = $builder->build_sample_item( { homebranch => $lib->branchcode, holdingbranch => $lib->branchcode, biblionumber => $item->biblionumber } ); t::lib::Mocks::mock_userenv( { branchcode => $lib->branchcode } ); @@ -2132,15 +2133,27 @@ subtest 'Remove item from holds queue on checkout' => sub { is( Koha::Hold::HoldsQueueItems->search( { itemnumber => $item->id } )->count(), 1, - "Item is found in the holds queue" + "One item is found in the holds queue" ); - AddIssue( $patron1, $item->barcode, dt_from_string ); + my $hq_item = Koha::Hold::HoldsQueueItems->search( { itemnumber => $item->id } )->next->item; + + AddIssue( $patron1, $hq_item->barcode, dt_from_string ); is( Koha::Hold::HoldsQueueItems->search( { itemnumber => $item->id } )->count(), 0, "Item is no longer found in the holds queue" ); + C4::HoldsQueue::CreateQueue(); + + is( + Koha::Hold::HoldsQueueItems->search( { itemnumber => $item2->id } )->count(), 1, + "One item is found in the holds queue" + ); + + my $hq_item2 = Koha::Hold::HoldsQueueItems->search( { itemnumber => $item2->id } )->next->item; + isnt( $hq_item->id, $hq_item2->id, "Item now targetd by the holds queue is not the same item." ); + $schema->storage->txn_rollback; }; --