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