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

(-)a/t/db_dependent/HoldsQueue.t (-2 / +32 lines)
Lines 8-14 Link Here
8
8
9
use Modern::Perl;
9
use Modern::Perl;
10
10
11
use Test::More tests => 60;
11
use Test::More tests => 61;
12
use Data::Dumper;
12
use Data::Dumper;
13
13
14
use C4::Calendar qw( new insert_single_holiday );
14
use C4::Calendar qw( new insert_single_holiday );
Lines 2060-2062 subtest "Test HoldsQueuePrioritizeBranch" => sub { Link Here
2060
2060
2061
    $schema->storage->txn_rollback;
2061
    $schema->storage->txn_rollback;
2062
};
2062
};
2063
- 
2063
2064
subtest "GetItemsAvailableToFillHoldsRequestsForBib" => sub {
2065
    plan tests => 2;
2066
2067
    $schema->storage->txn_begin;
2068
2069
    my $item_1 = $builder->build_sample_item();
2070
    my $item_2 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber });
2071
    my $item_3 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber });
2072
2073
    my $transfer_1 = $builder->build_object({ class => 'Koha::Item::Transfers', value => {
2074
        itemnumber => $item_1->itemnumber,
2075
        datearrived => undef,
2076
        datecancelled => undef
2077
    }});
2078
    my $transfer_2 = $builder->build_object({ class => 'Koha::Item::Transfers', value => {
2079
        itemnumber => $item_2->itemnumber,
2080
        datearrived => dt_from_string,
2081
        datecancelled => undef
2082
    }});
2083
    my $transfer_3 = $builder->build_object({ class => 'Koha::Item::Transfers', value => {
2084
        itemnumber => $item_3->itemnumber,
2085
        datearrived => undef,
2086
        datecancelled => dt_from_string
2087
    }});
2088
2089
    my $items = C4::HoldsQueue::GetItemsAvailableToFillHoldRequestsForBib( $item_1->biblionumber );
2090
    is( scalar @$items, 2, "Two items without active transfers correctly retrieved");
2091
    is_deeply( [$items->[0]->{itemnumber},$items->[1]->{itemnumber}],[$item_2->itemnumber,$item_3->itemnumber],"Correct two items retrieved");
2092
2093
};

Return to bug 33761