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

Return to bug 37651