View | Details | Raw Unified | Return to bug 23964
Collapse All | Expand All

(-)a/t/db_dependent/Reserves.t (-4 / +5 lines)
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 => 11;
675
    plan tests => 13;
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 720-729 subtest 'ReservesNeedReturns' => sub { Link Here
720
    t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1); # '0' means damaged holds not allowed
720
    t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1); # '0' means damaged holds not allowed
721
    $hold = place_item_hold( $patron, $item, $library, $priority );
721
    $hold = place_item_hold( $patron, $item, $library, $priority );
722
    is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and damaged holds allowed, priority must have been set to 0' );
722
    is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and damaged holds allowed, priority must have been set to 0' );
723
    is( $hold->found, 'W', 'If ReservesNeedReturns is 0 and damaged holds allowed, found must have been set waiting' );
723
    is( $hold->found,  'W', 'If ReservesNeedReturns is 0 and damaged holds allowed, found must have been set waiting' );
724
    $hold->delete;
724
    $hold->delete;
725
725
726
    my $hold_1 = place_item_hold( $patron, $item, $library, $priority );
726
    my $hold_1 = place_item_hold( $patron, $item, $library, $priority );
727
    is( $hold_1->found,  'W', 'First hold on item is set to waiting with ReservesNeedReturns set to 0' );
727
    is( $hold_1->priority, 0, 'First hold on item is set to waiting with ReservesNeedReturns set to 0' );
728
    is( $hold_1->priority, 0, 'First hold on item is set to waiting with ReservesNeedReturns set to 0' );
728
    $hold = place_item_hold( $patron_2, $item, $library, $priority );
729
    $hold = place_item_hold( $patron_2, $item, $library, $priority );
729
    is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item already on hold priority must be set to 1' );
730
    is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item already on hold priority must be set to 1' );
Lines 736-742 subtest 'ReservesNeedReturns' => sub { Link Here
736
    } });
737
    } });
737
    $item->damaged(0)->store;
738
    $item->damaged(0)->store;
738
    $hold = place_item_hold( $patron, $item, $library, $priority );
739
    $hold = place_item_hold( $patron, $item, $library, $priority );
739
    is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' );
740
    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' );
740
742
741
    t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests
743
    t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests
742
};
744
};
743
- 

Return to bug 23964