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

(-)a/t/db_dependent/Reserves.t (-3 / +4 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 => 10;
675
    plan tests => 11;
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 721-728 subtest 'ReservesNeedReturns' => sub { Link Here
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
725
725
    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->priority, 0, 'First hold on item is set to waiting with ReservesNeedReturns set to 0' );
726
    $hold = place_item_hold( $patron_2, $item, $library, $priority );
728
    $hold = place_item_hold( $patron_2, $item, $library, $priority );
727
    is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item already on hold priority must be set to 1' );
729
    is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item already on hold priority must be set to 1' );
728
    $hold->delete;
730
    $hold->delete;
Lines 734-740 subtest 'ReservesNeedReturns' => sub { Link Here
734
    } });
736
    } });
735
    $item->damaged(0)->store;
737
    $item->damaged(0)->store;
736
    $hold = place_item_hold( $patron, $item, $library, $priority );
738
    $hold = place_item_hold( $patron, $item, $library, $priority );
737
    isnt( $hold->priority, 0, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' );
739
    is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' );
738
740
739
    t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests
741
    t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests
740
};
742
};
741
- 

Return to bug 23964