Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 70; |
20 |
use Test::More tests => 71; |
21 |
use Test::NoWarnings; |
21 |
use Test::NoWarnings; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
Lines 1351-1356
subtest 'AllowHoldOnPatronPossession test' => sub {
Link Here
|
1351 |
); |
1351 |
); |
1352 |
}; |
1352 |
}; |
1353 |
|
1353 |
|
|
|
1354 |
subtest 'check maxreserve test' => sub { |
1355 |
|
1356 |
plan tests => 2; |
1357 |
|
1358 |
$schema->storage->txn_begin; |
1359 |
t::lib::Mocks::mock_preference( 'maxreserves', 1 ); |
1360 |
|
1361 |
# Create the items and patrons we need |
1362 |
my $biblio_1 = $builder->build_sample_biblio(); |
1363 |
my $biblio_2 = $builder->build_sample_biblio(); |
1364 |
my $itype = $builder->build_object( { class => "Koha::ItemTypes", value => { notforloan => 0 } } ); |
1365 |
my $item_1 = $builder->build_sample_item( |
1366 |
{ biblionumber => $biblio_1->biblionumber, notforloan => 0, itype => $itype->itemtype } ); |
1367 |
my $item_2 = $builder->build_sample_item( |
1368 |
{ biblionumber => $biblio_2->biblionumber, notforloan => 0, itype => $itype->itemtype } ); |
1369 |
my $patron = $builder->build_object( |
1370 |
{ |
1371 |
class => "Koha::Patrons", |
1372 |
value => { branchcode => $item_2->homebranch } |
1373 |
} |
1374 |
); |
1375 |
|
1376 |
# Place a hold on the title for both patrons |
1377 |
my $reserve = AddReserve( |
1378 |
{ |
1379 |
branchcode => $item_1->homebranch, |
1380 |
borrowernumber => $patron->borrowernumber, |
1381 |
biblionumber => $biblio_1->biblionumber, |
1382 |
priority => 1, |
1383 |
itemnumber => $item_1->itemnumber, |
1384 |
} |
1385 |
); |
1386 |
|
1387 |
my $borrowernumber = $patron->borrowernumber; |
1388 |
|
1389 |
is( |
1390 |
C4::Reserves::CanBookBeReserved( $borrowernumber, $biblio_2->biblionumber )->{status}, 'tooManyReserves', |
1391 |
"CanBookBeReserved: Reserving more than maxreserves is forbidden" |
1392 |
); |
1393 |
is( |
1394 |
C4::Reserves::CanItemBeReserved( $patron, $item_2, $item_2->homebranch )->{status}, 'tooManyReserves', |
1395 |
"CanItemBeReserved: Reserving more than maxreserves is forbidden" |
1396 |
); |
1397 |
t::lib::Mocks::mock_preference( 'maxreserves', 20 ); |
1398 |
$schema->storage->txn_rollback; |
1399 |
}; |
1400 |
|
1354 |
subtest 'MergeHolds' => sub { |
1401 |
subtest 'MergeHolds' => sub { |
1355 |
|
1402 |
|
1356 |
plan tests => 1; |
1403 |
plan tests => 1; |
1357 |
- |
|
|