Lines 455-461
is(
Link Here
|
455 |
); |
455 |
); |
456 |
|
456 |
|
457 |
subtest 'CanItemBeReserved' => sub { |
457 |
subtest 'CanItemBeReserved' => sub { |
458 |
plan tests => 2; |
458 |
plan tests => 3; |
459 |
|
459 |
|
460 |
my $itemtype_can = $builder->build( { source => "Itemtype" } )->{itemtype}; |
460 |
my $itemtype_can = $builder->build( { source => "Itemtype" } )->{itemtype}; |
461 |
my $itemtype_cant = $builder->build( { source => "Itemtype" } )->{itemtype}; |
461 |
my $itemtype_cant = $builder->build( { source => "Itemtype" } )->{itemtype}; |
Lines 717-722
subtest 'CanItemBeReserved' => sub {
Link Here
|
717 |
"This patron has already placed reservesallowed holds, tooManyReserves should be raised" |
717 |
"This patron has already placed reservesallowed holds, tooManyReserves should be raised" |
718 |
); |
718 |
); |
719 |
}; |
719 |
}; |
|
|
720 |
|
721 |
subtest 'item status tests' => sub { |
722 |
plan tests => 6; |
723 |
|
724 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
725 |
my $item = $builder->build_sample_item(); |
726 |
my $biblioitem = $item->biblio->biblioitem; |
727 |
$biblioitem->itemtype(undef)->store(); |
728 |
$item->update( { itype => undef } ); |
729 |
is( |
730 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'missing_itemtype', |
731 |
"Item with no itemtype cannot be reserved" |
732 |
); |
733 |
|
734 |
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes', value => { notforloan => 1 } } ); |
735 |
$item->itype( $itemtype->id )->store(); |
736 |
|
737 |
is( |
738 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'notforloan', |
739 |
"Item with no notforloan itemtype cannot be reserved" |
740 |
); |
741 |
|
742 |
$itemtype->notforloan(0)->store(); |
743 |
$item->notforloan(1)->store(); |
744 |
|
745 |
is( |
746 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'notforloan', |
747 |
"Item with no notforloan status cannot be reserved" |
748 |
); |
749 |
|
750 |
$item->notforloan(-1)->store(); |
751 |
|
752 |
is( |
753 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'OK', |
754 |
"Item with negative notforloan status can be reserved" |
755 |
); |
756 |
|
757 |
$item->notforloan(0)->store(); |
758 |
|
759 |
is( CanItemBeReserved( $patrons[0], $item )->{status}, 'OK', "Item with no notforloan status can be reserved" ); |
760 |
|
761 |
$item->withdrawn(1)->store(); |
762 |
|
763 |
is( |
764 |
CanItemBeReserved( $patrons[0], $item )->{status}, 'withdrawn', |
765 |
"Item with withdrawn status cannot be reserved" |
766 |
); |
767 |
}; |
720 |
}; |
768 |
}; |
721 |
|
769 |
|
722 |
# Test branch item rules |
770 |
# Test branch item rules |
723 |
- |
|
|