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

(-)a/t/db_dependent/HoldsQueue.t (-2 / +54 lines)
Lines 9-15 Link Here
9
use Modern::Perl;
9
use Modern::Perl;
10
10
11
use Test::NoWarnings;
11
use Test::NoWarnings;
12
use Test::More tests => 65;
12
use Test::More tests => 66;
13
use Data::Dumper;
13
use Data::Dumper;
14
14
15
use C4::Calendar;
15
use C4::Calendar;
Lines 2534-2536 subtest "Test unallocated option" => sub { Link Here
2534
        "Previously allocated hold not updated when unallocated passed and others are allocated"
2534
        "Previously allocated hold not updated when unallocated passed and others are allocated"
2535
    );
2535
    );
2536
};
2536
};
2537
- 
2537
2538
subtest "Suspended holds should be removed from the holds queue" => sub {
2539
2540
    plan tests => 2;
2541
2542
    $schema->storage->txn_begin;
2543
2544
    t::lib::Mocks::mock_preference( 'LocalHoldsPriority',     'None' );
2545
    t::lib::Mocks::mock_preference( 'UseTransportCostMatrix', 0 );
2546
2547
    my $branch1  = $builder->build_object( { class => 'Koha::Libraries' } );
2548
    my $category = $builder->build_object( { class => 'Koha::Patron::Categories' } );
2549
    my $patron   = $builder->build_object(
2550
        {
2551
            class => "Koha::Patrons",
2552
            value => {
2553
                branchcode   => $branch1->branchcode,
2554
                categorycode => $category->categorycode
2555
            }
2556
        }
2557
    );
2558
2559
    my $biblio = $builder->build_sample_biblio();
2560
    my $item1  = $builder->build_sample_item(
2561
        {
2562
            biblionumber => $biblio->biblionumber,
2563
            library      => $branch1->branchcode,
2564
        }
2565
    );
2566
2567
    my $reserve_id = AddReserve(
2568
        {
2569
            branchcode     => $branch1->branchcode,
2570
            borrowernumber => $patron->borrowernumber,
2571
            biblionumber   => $biblio->biblionumber,
2572
            priority       => 1,
2573
        }
2574
    );
2575
2576
    C4::HoldsQueue::CreateQueue();
2577
    my $rs = $schema->resultset('TmpHoldsqueue');
2578
2579
    is( $rs->search( { biblionumber => $biblio->biblionumber } )->count, 1, "Found the hold in the holds queue" );
2580
2581
    Koha::Holds->find($reserve_id)->suspend_hold();
2582
2583
    is(
2584
        $rs->search( { biblionumber => $biblio->biblionumber } )->count, 0,
2585
        "Hold is no longer found in the holds queue after suspension"
2586
    );
2587
2588
    $schema->storage->txn_rollback;
2589
};

Return to bug 41552