|
Lines 418-424
is(
Link Here
|
| 418 |
); |
418 |
); |
| 419 |
|
419 |
|
| 420 |
subtest 'CanItemBeReserved' => sub { |
420 |
subtest 'CanItemBeReserved' => sub { |
| 421 |
plan tests => 2; |
421 |
plan tests => 3; |
| 422 |
|
422 |
|
| 423 |
my $itemtype_can = $builder->build({source => "Itemtype"})->{itemtype}; |
423 |
my $itemtype_can = $builder->build({source => "Itemtype"})->{itemtype}; |
| 424 |
my $itemtype_cant = $builder->build({source => "Itemtype"})->{itemtype}; |
424 |
my $itemtype_cant = $builder->build({source => "Itemtype"})->{itemtype}; |
|
Lines 627-632
subtest 'CanItemBeReserved' => sub {
Link Here
|
| 627 |
"This patron has already placed reservesallowed holds, tooManyReserves should be raised" |
627 |
"This patron has already placed reservesallowed holds, tooManyReserves should be raised" |
| 628 |
); |
628 |
); |
| 629 |
}; |
629 |
}; |
|
|
630 |
|
| 631 |
subtest 'item status tests' => sub { |
| 632 |
plan tests => 6; |
| 633 |
|
| 634 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
| 635 |
my $item = $builder->build_sample_item(); |
| 636 |
my $biblioitem = $item->biblio->biblioitem; |
| 637 |
$biblioitem->itemtype(undef)->store(); |
| 638 |
$item->update( { itype => undef } ); |
| 639 |
is( |
| 640 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'missing_itemtype', |
| 641 |
"Item with no itemtype cannot be reserved" |
| 642 |
); |
| 643 |
|
| 644 |
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes', value => { notforloan => 1 } } ); |
| 645 |
$item->itype( $itemtype->id )->store(); |
| 646 |
|
| 647 |
is( |
| 648 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'notforloan', |
| 649 |
"Item with no notforloan itemtype cannot be reserved" |
| 650 |
); |
| 651 |
|
| 652 |
$itemtype->notforloan(undef)->store(); |
| 653 |
$item->notforloan(1)->store(); |
| 654 |
|
| 655 |
is( |
| 656 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'notforloan', |
| 657 |
"Item with no notforloan status cannot be reserved" |
| 658 |
); |
| 659 |
|
| 660 |
$item->notforloan(-1)->store(); |
| 661 |
|
| 662 |
is( |
| 663 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'OK', |
| 664 |
"Item with negative notforloan status can be reserved" |
| 665 |
); |
| 666 |
|
| 667 |
$item->notforloan(0)->store(); |
| 668 |
|
| 669 |
is( CanItemBeReserved( $patrons[0], $item )->{status}, 'OK', "Item with no notforloan status can be reserved" ); |
| 670 |
|
| 671 |
$item->withdrawn(1)->store(); |
| 672 |
|
| 673 |
is( |
| 674 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'withdrawn', |
| 675 |
"Item with withdrawn status cannot be reserved" |
| 676 |
); |
| 677 |
}; |
| 630 |
}; |
678 |
}; |
| 631 |
|
679 |
|
| 632 |
|
680 |
|
| 633 |
- |
|
|