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

(-)a/t/db_dependent/Holds.t (-1 / +24 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 73;
10
use Test::More tests => 74;
11
use Test::NoWarnings;
11
use Test::NoWarnings;
12
use Test::Exception;
12
use Test::Exception;
13
13
Lines 2109-2111 subtest 'EmailPatronWhenHoldIsPlaced tests' => sub { Link Here
2109
2109
2110
    $schema->storage->txn_rollback;
2110
    $schema->storage->txn_rollback;
2111
};
2111
};
2112
2113
subtest 'current_holds with future holds' => sub {
2114
    plan tests => 2;
2115
    $schema->storage->txn_begin;
2116
2117
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 );
2118
    my $item    = $builder->build_sample_item;
2119
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
2120
    my $hold_id = AddReserve(
2121
        {
2122
            reservation_date => dt_from_string()->add( days => 1 ),
2123
            branchcode       => $item->homebranch,
2124
            borrowernumber   => $patron->id,
2125
            biblionumber     => $item->biblionumber,
2126
            itemnumber       => $item->itemnumber,
2127
        }
2128
    );
2129
    is( $item->biblio->current_holds->count, 1, 'Future hold was counted' );
2130
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
2131
    is( $item->biblio->current_holds->count, 0, 'No future hold was counted when ConfirmFutureHolds is zero' );
2132
2133
    $schema->storage->txn_rollback;
2134
};
(-)a/t/db_dependent/Koha/Biblios.t (-4 / +7 lines)
Lines 62-68 subtest 'store' => sub { Link Here
62
};
62
};
63
63
64
subtest 'holds + current_holds' => sub {
64
subtest 'holds + current_holds' => sub {
65
    plan tests => 5;
65
    plan tests => 6;
66
    C4::Reserves::AddReserve(
66
    C4::Reserves::AddReserve(
67
        {
67
        {
68
            branchcode     => $patron->branchcode,
68
            branchcode     => $patron->branchcode,
Lines 85-96 subtest 'holds + current_holds' => sub { Link Here
85
            reservation_date => dt_from_string->add( days => 2 ),
85
            reservation_date => dt_from_string->add( days => 2 ),
86
        }
86
        }
87
    );
87
    );
88
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
88
    $holds = $biblio->holds;
89
    $holds = $biblio->holds;
89
    is( $holds->count, 1, '->holds should return future holds' );
90
    is( $holds->count, 1, '->holds should return future holds' );
90
    $holds = $biblio->current_holds;
91
    $holds = $biblio->current_holds;
91
    is( $holds->count, 0, '->current_holds should not return future holds' );
92
    is( $holds->count, 0, '->current_holds without lookahead should not return future holds' );
93
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 );
94
    $holds = $biblio->current_holds;
95
    is( $holds->count, 1, '->current_holds with lookahead returns future holds' );
92
    $holds->delete;
96
    $holds->delete;
93
97
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
94
};
98
};
95
99
96
subtest 'waiting_or_in_transit' => sub {
100
subtest 'waiting_or_in_transit' => sub {
97
- 

Return to bug 37651