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

(-)a/t/db_dependent/Reserves.t (-2 / +41 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 77;
20
use Test::More tests => 78;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 30-35 use DateTime::Duration; Link Here
30
use C4::Circulation qw( AddReturn AddIssue );
30
use C4::Circulation qw( AddReturn AddIssue );
31
use C4::Items;
31
use C4::Items;
32
use C4::Biblio qw( GetMarcFromKohaField ModBiblio );
32
use C4::Biblio qw( GetMarcFromKohaField ModBiblio );
33
use C4::HoldsQueue;
33
use C4::Members;
34
use C4::Members;
34
use C4::Reserves qw( AddReserve AlterPriority CheckReserves GetReservesControlBranch ModReserve ModReserveAffect ReserveSlip CalculatePriority CanReserveBeCanceledFromOpac CanBookBeReserved IsAvailableForItemLevelRequest MoveReserve ChargeReserveFee RevertWaitingStatus CanItemBeReserved MergeHolds );
35
use C4::Reserves qw( AddReserve AlterPriority CheckReserves GetReservesControlBranch ModReserve ModReserveAffect ReserveSlip CalculatePriority CanReserveBeCanceledFromOpac CanBookBeReserved IsAvailableForItemLevelRequest MoveReserve ChargeReserveFee RevertWaitingStatus CanItemBeReserved MergeHolds );
35
use Koha::ActionLogs;
36
use Koha::ActionLogs;
Lines 1773-1775 subtest 'DefaultHoldExpiration tests' => sub { Link Here
1773
1774
1774
    $schema->txn_rollback;
1775
    $schema->txn_rollback;
1775
};
1776
};
1776
- 
1777
1778
subtest '_Findgroupreserves' => sub {
1779
    plan tests => 1;
1780
    $schema->storage->txn_begin;
1781
1782
    my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } );
1783
    my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } );
1784
    my $item     = $builder->build_sample_item();
1785
1786
    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 );
1787
    my $reserve_id_1 = AddReserve(
1788
        {
1789
            branchcode     => $item->homebranch,
1790
            borrowernumber => $patron_1->id,
1791
            biblionumber   => $item->biblionumber,
1792
        }
1793
    );
1794
    my $reserve_id_2 = AddReserve(
1795
        {
1796
            branchcode     => $item->homebranch,
1797
            borrowernumber => $patron_2->id,
1798
            biblionumber   => $item->biblionumber,
1799
        }
1800
    );
1801
1802
    C4::HoldsQueue::AddToHoldTargetMap(
1803
        {
1804
            $item->id => {
1805
                borrowernumber => $patron_1->id,        biblionumber => $item->biblionumber,
1806
                holdingbranch  => $item->holdingbranch, item_level   => 0, reserve_id => $reserve_id_1
1807
            }
1808
        }
1809
    );
1810
1811
    # 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
    is( scalar @reserves, 1, "We should only get the hold that is in the map" );
1814
    $schema->txn_rollback;
1815
};

Return to bug 34666