Bug 34678: Unit test
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> (cherry picked from commitdfad12d079) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commitb4a5c3213f) Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
parent
e7fcc23f4b
commit
22c8353ffa
|
|
@ -1779,7 +1779,7 @@ subtest 'DefaultHoldExpiration tests' => sub {
|
|||
};
|
||||
|
||||
subtest '_Findgroupreserves' => sub {
|
||||
plan tests => 4;
|
||||
plan tests => 6;
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } );
|
||||
|
|
@ -1806,8 +1806,8 @@ subtest '_Findgroupreserves' => sub {
|
|||
C4::HoldsQueue::AddToHoldTargetMap(
|
||||
{
|
||||
$item->id => {
|
||||
borrowernumber => $patron_1->id, biblionumber => $item->biblionumber,
|
||||
holdingbranch => $item->holdingbranch, item_level => 0, reserve_id => $reserve_id_1
|
||||
borrowernumber => $patron_1->id, biblionumber => $item->biblionumber,
|
||||
holdingbranch => $item->holdingbranch, item_level => 0, reserve_id => $reserve_id_1
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -1831,5 +1831,21 @@ subtest '_Findgroupreserves' => sub {
|
|||
is( scalar @reserves, 1, "We should only get the item level hold that is in the map" );
|
||||
is( $reserves[0]->{reserve_id}, $reserve_id_2, "We got the expected reserve" );
|
||||
|
||||
C4::HoldsQueue::AddToHoldTargetMap(
|
||||
{
|
||||
$item_2->id => {
|
||||
borrowernumber => $patron_2->id, biblionumber => $item->biblionumber,
|
||||
holdingbranch => $item->holdingbranch, item_level => 1, reserve_id => $reserve_id_1
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
# When the hold is title level and in the hold fill targets we expect this to be the only hold returned
|
||||
@reserves = C4::Reserves::_Findgroupreserve( $item->biblionumber, $item_2->id, 0, [] );
|
||||
is( scalar @reserves, 1, "We should still only get the item level hold that is in the map" );
|
||||
is( $reserves[0]->{reserve_id}, $reserve_id_1, "We got the expected reserve which has been updated" );
|
||||
|
||||
|
||||
|
||||
$schema->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue