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