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

(-)a/t/db_dependent/Koha/Holds.t (-2 / +14 lines)
Lines 411-417 subtest 'Desks' => sub { Link Here
411
};
411
};
412
412
413
subtest 'get_items_that_can_fill' => sub {
413
subtest 'get_items_that_can_fill' => sub {
414
    plan tests => 5;
414
    plan tests => 6;
415
415
416
    my $biblio = $builder->build_sample_biblio;
416
    my $biblio = $builder->build_sample_biblio;
417
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
417
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
Lines 503-508 subtest 'get_items_that_can_fill' => sub { Link Here
503
    is_deeply( [ map { $_->itemnumber } $items->as_list ],
503
    is_deeply( [ map { $_->itemnumber } $items->as_list ],
504
        [ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' );
504
        [ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' );
505
505
506
507
    my $noloan_itype = $builder->build_object( { class => 'Koha::ItemTypes', value => { notforloan => 1 } } );
508
    t::lib::Mocks::mock_preference( 'item-level_itypes', 0 );
509
    Koha::Holds->find( $waiting_reserve_id )->delete;
510
    $holds = Koha::Holds->search(
511
        {
512
            reserve_id => [ $reserve_id_1, $reserve_id_2 ]
513
        }
514
    );
515
    $items = $holds->get_items_that_can_fill;
516
    is_deeply( [ map { $_->itemnumber } $items->as_list ],
517
        [ $item_1->itemnumber, $item_2->itemnumber, $item_5->itemnumber ], 'Items 1, 2, and 5 are available for filling the holds' );
518
506
    my $no_holds = Koha::Holds->new->empty();
519
    my $no_holds = Koha::Holds->new->empty();
507
    my $no_items = $no_holds->get_items_that_can_fill();
520
    my $no_items = $no_holds->get_items_that_can_fill();
508
    is( ref $no_items, "Koha::Items", "Routine returns a Koha::Items object");
521
    is( ref $no_items, "Koha::Items", "Routine returns a Koha::Items object");
509
- 

Return to bug 30432