View | Details | Raw Unified | Return to bug 34666
Collapse All | Expand All

(-)a/t/db_dependent/Reserves.t (-3 / +19 lines)
Lines 1776-1787 subtest 'DefaultHoldExpiration tests' => sub { Link Here
1776
};
1776
};
1777
1777
1778
subtest '_Findgroupreserves' => sub {
1778
subtest '_Findgroupreserves' => sub {
1779
    plan tests => 1;
1779
    plan tests => 4;
1780
    $schema->storage->txn_begin;
1780
    $schema->storage->txn_begin;
1781
1781
1782
    my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } );
1782
    my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } );
1783
    my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } );
1783
    my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } );
1784
    my $item     = $builder->build_sample_item();
1784
    my $item     = $builder->build_sample_item();
1785
    my $item_2 = $builder->build_sample_item( { biblionumber => $item->biblionumber } );
1785
1786
1786
    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 );
1787
    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 );
1787
    my $reserve_id_1 = AddReserve(
1788
    my $reserve_id_1 = AddReserve(
Lines 1810-1815 subtest '_Findgroupreserves' => sub { Link Here
1810
1811
1811
    # When the hold is title level and in the hold fill targets we expect this to be the only hold returned
1812
    # When the hold is title level and in the hold fill targets we expect this to be the only hold returned
1812
    my @reserves = C4::Reserves::_Findgroupreserve( $item->biblionumber, $item->id, 0, [] );
1813
    my @reserves = C4::Reserves::_Findgroupreserve( $item->biblionumber, $item->id, 0, [] );
1813
    is( scalar @reserves, 1, "We should only get the hold that is in the map" );
1814
    is( scalar @reserves,           1,             "We should only get the hold that is in the map" );
1815
    is( $reserves[0]->{reserve_id}, $reserve_id_1, "We got the expected reserve" );
1816
1817
    C4::HoldsQueue::AddToHoldTargetMap(
1818
        {
1819
            $item_2->id => {
1820
                borrowernumber => $patron_2->id,        biblionumber => $item->biblionumber,
1821
                holdingbranch  => $item->holdingbranch, item_level   => 1, reserve_id => $reserve_id_2
1822
            }
1823
        }
1824
    );
1825
1826
    # When the hold is title level and in the hold fill targets we expect this to be the only hold returned
1827
    @reserves = C4::Reserves::_Findgroupreserve( $item->biblionumber, $item_2->id, 0, [] );
1828
    is( scalar @reserves,           1,             "We should only get the item level hold that is in the map" );
1829
    is( $reserves[0]->{reserve_id}, $reserve_id_2, "We got the expected reserve" );
1830
1814
    $schema->txn_rollback;
1831
    $schema->txn_rollback;
1815
};
1832
};
1816
- 

Return to bug 34666