Lines 672-678
subtest '_koha_notify_reserve() tests' => sub {
Link Here
|
672 |
}; |
672 |
}; |
673 |
|
673 |
|
674 |
subtest 'ReservesNeedReturns' => sub { |
674 |
subtest 'ReservesNeedReturns' => sub { |
675 |
plan tests => 13; |
675 |
plan tests => 18; |
676 |
|
676 |
|
677 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
677 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
678 |
my $item_info = { |
678 |
my $item_info = { |
Lines 731-744
subtest 'ReservesNeedReturns' => sub {
Link Here
|
731 |
$hold->delete; |
731 |
$hold->delete; |
732 |
$hold_1->delete; |
732 |
$hold_1->delete; |
733 |
|
733 |
|
734 |
$builder->build({ source => "Branchtransfer", value => { |
734 |
my $transfer = $builder->build_object({ |
735 |
itemnumber => $item->itemnumber, |
735 |
class => "Koha::Item::Transfers", |
736 |
datearrived => undef, |
736 |
value => { |
737 |
} }); |
737 |
itemnumber => $item->itemnumber, |
|
|
738 |
datearrived => undef, |
739 |
} |
740 |
}); |
738 |
$item->damaged(0)->store; |
741 |
$item->damaged(0)->store; |
739 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
742 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
740 |
is( $hold->found, undef, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
743 |
is( $hold->found, undef, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
741 |
is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
744 |
is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); |
|
|
745 |
$hold->delete; |
746 |
$transfer->delete; |
747 |
|
748 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
749 |
is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and no other status, priority must have been set to 0' ); |
750 |
is( $hold->found, 'W', 'If ReservesNeedReturns is 0 and no other status, found must have been set waiting' ); |
751 |
$hold_1 = place_item_hold( $patron, $item, $library, $priority ); |
752 |
is( $hold_1->priority, 1, 'If ReservesNeedReturns is 0 but item has a hold priority is 1' ); |
753 |
$hold_1->suspend(1)->store; # We suspend the hold |
754 |
$hold->delete; # Delete the waiting hold |
755 |
$hold = place_item_hold( $patron, $item, $library, $priority ); |
756 |
is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and other hold(s) suspended, priority must have been set to 0' ); |
757 |
is( $hold->found, 'W', 'If ReservesNeedReturns is 0 and other hold(s) suspended, found must have been set waiting' ); |
758 |
|
759 |
|
760 |
|
742 |
|
761 |
|
743 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests |
762 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests |
744 |
}; |
763 |
}; |
745 |
- |
|
|