Lines 664-670
subtest '_koha_notify_reserve() tests' => sub {
Link Here
|
664 |
}; |
664 |
}; |
665 |
|
665 |
|
666 |
subtest 'ReservesNeedReturns' => sub { |
666 |
subtest 'ReservesNeedReturns' => sub { |
667 |
plan tests => 13; |
667 |
plan tests => 18; |
668 |
|
668 |
|
669 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
669 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
670 |
my $item_info = { |
670 |
my $item_info = { |
Lines 723-736
subtest 'ReservesNeedReturns' => sub {
Link Here
|
723 |
$hold->delete; |
723 |
$hold->delete; |
724 |
$hold_1->delete; |
724 |
$hold_1->delete; |
725 |
|
725 |
|
726 |
$builder->build({ source => "Branchtransfer", value => { |
726 |
my $transfer = $builder->build_object({ |
727 |
itemnumber => $item->itemnumber, |
727 |
class => "Koha::Item::Transfers", |
728 |
datearrived => undef, |
728 |
value => { |
729 |
} }); |
729 |
itemnumber => $item->itemnumber, |
|
|
730 |
datearrived => undef, |
731 |
} |
732 |
}); |
730 |
$item->damaged(0)->store; |
733 |
$item->damaged(0)->store; |
731 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
734 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
732 |
is( $hold->found, undef, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
735 |
is( $hold->found, undef, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
733 |
is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
736 |
is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
|
|
737 |
$hold->delete; |
738 |
$transfer->delete; |
739 |
|
740 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
741 |
is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and no other status, priority must have been set to 0' ); |
742 |
is( $hold->found, 'W', 'If ReservesNeedReturns is 0 and no other status, found must have been set waiting' ); |
743 |
$hold_1 = place_item_hold( $patron, $item, $library, $priority ); |
744 |
is( $hold_1->priority, 1, 'If ReservesNeedReturns is 0 but item has a hold priority is 1' ); |
745 |
$hold_1->suspend(1)->store; # We suspend the hold |
746 |
$hold->delete; # Delete the waiting hold |
747 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
748 |
is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and other hold(s) suspended, priority must have been set to 0' ); |
749 |
is( $hold->found, 'W', 'If ReservesNeedReturns is 0 and other hold(s) suspended, found must have been set waiting' ); |
750 |
|
751 |
|
752 |
|
734 |
|
753 |
|
735 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests |
754 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests |
736 |
}; |
755 |
}; |
737 |
- |
|
|