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

(-)a/t/db_dependent/Circulation.t (-2 / +68 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 70;
21
use Test::More tests => 71;
22
use Test::Exception;
22
use Test::Exception;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
Lines 6368-6373 subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { Link Here
6368
6368
6369
};
6369
};
6370
6370
6371
subtest 'Tests for GetOtherReserves' => sub {
6372
    plan tests => 4;
6373
6374
    my $library  = $builder->build_object( { class => 'Koha::Libraries' } );
6375
    my $patron_1 = $builder->build_object(
6376
        {
6377
            class => 'Koha::Patrons',
6378
        }
6379
    );
6380
    my $patron_2 = $builder->build_object(
6381
        {
6382
            class => 'Koha::Patrons',
6383
        }
6384
    );
6385
6386
    # GetOtherReserves uses the ItemType object to check not-for-loan value
6387
    my $itype = $builder->build_object(
6388
        {
6389
            class => 'Koha::ItemTypes',
6390
            value => {
6391
                notforloan => 0,
6392
            }
6393
        }
6394
    );
6395
6396
    my $item = $builder->build_object(
6397
        {
6398
            class => 'Koha::Items',
6399
            value => {
6400
                itype      => $itype->itemtype,
6401
                homebranch => $library->branchcode,
6402
            }
6403
        }
6404
    );
6405
6406
    t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } );
6407
6408
    my $reserve_1_id = AddReserve(
6409
        {
6410
            branchcode     => $item->homebranch,
6411
            borrowernumber => $patron_1->borrowernumber,
6412
            biblionumber   => $item->biblionumber,
6413
        }
6414
    );
6415
6416
    my $reserve_2_id = AddReserve(
6417
        {
6418
            branchcode     => $item->homebranch,
6419
            borrowernumber => $patron_2->borrowernumber,
6420
            biblionumber   => $item->biblionumber,
6421
        }
6422
    );
6423
6424
    my $messages;
6425
    my $nextreservinfo;
6426
    ( $messages, $nextreservinfo ) = GetOtherReserves( $item->itemnumber );
6427
6428
    my $reserve_1 = Koha::Holds->search( { reserve_id => $reserve_1_id } )->next;
6429
6430
    is(
6431
        $nextreservinfo->{reserve_id}, $reserve_1->reserve_id,
6432
        'GetOtherReserves should return the next reserve in line'
6433
    );
6434
    is( $reserve_1->priority, 1, 'Next reserve in line should be priority 1' );
6435
    ok( !$reserve_1->found,      'GetOtherReserves should not set found status' );
6436
    ok( !$reserve_1->itemnumber, 'GetOtherReserves should not set itemnumber on a biblio-level hold' );
6437
};
6371
6438
6372
$schema->storage->txn_rollback;
6439
$schema->storage->txn_rollback;
6373
C4::Context->clear_syspref_cache();
6440
C4::Context->clear_syspref_cache();
6374
- 

Return to bug 34972