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 1879-1881 subtest 'EmailPatronWhenHoldIsPlaced tests' => sub { Link Here
1879
1879
1880
    $schema->storage->txn_rollback;
1880
    $schema->storage->txn_rollback;
1881
};
1881
};
1882
1883
subtest 'current_holds with future holds' => sub {
1884
    plan tests => 2;
1885
    $schema->storage->txn_begin;
1886
1887
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 );
1888
    my $item    = $builder->build_sample_item;
1889
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
1890
    my $hold_id = AddReserve(
1891
        {
1892
            reservation_date => dt_from_string()->add( days => 1 ),
1893
            branchcode       => $item->homebranch,
1894
            borrowernumber   => $patron->id,
1895
            biblionumber     => $item->biblionumber,
1896
            itemnumber       => $item->itemnumber,
1897
        }
1898
    );
1899
    is( $item->biblio->current_holds->count, 1, 'Future hold was counted' );
1900
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
1901
    is( $item->biblio->current_holds->count, 0, 'No future hold was counted when ConfirmFutureHolds is zero' );
1902
1903
    $schema->storage->txn_rollback;
1904
};
(-)a/t/db_dependent/Koha/Biblios.t (-4 / +7 lines)
Lines 67-73 subtest 'store' => sub { Link Here
67
};
67
};
68
68
69
subtest 'holds + current_holds' => sub {
69
subtest 'holds + current_holds' => sub {
70
    plan tests => 5;
70
    plan tests => 6;
71
    C4::Reserves::AddReserve(
71
    C4::Reserves::AddReserve(
72
        {
72
        {
73
            branchcode     => $patron->branchcode,
73
            branchcode     => $patron->branchcode,
Lines 90-101 subtest 'holds + current_holds' => sub { Link Here
90
            reservation_date => dt_from_string->add( days => 2 ),
90
            reservation_date => dt_from_string->add( days => 2 ),
91
        }
91
        }
92
    );
92
    );
93
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
93
    $holds = $biblio->holds;
94
    $holds = $biblio->holds;
94
    is( $holds->count, 1, '->holds should return future holds' );
95
    is( $holds->count, 1, '->holds should return future holds' );
95
    $holds = $biblio->current_holds;
96
    $holds = $biblio->current_holds;
96
    is( $holds->count, 0, '->current_holds should not return future holds' );
97
    is( $holds->count, 0, '->current_holds without lookahead should not return future holds' );
98
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 );
99
    $holds = $biblio->current_holds;
100
    is( $holds->count, 1, '->current_holds with lookahead returns future holds' );
97
    $holds->delete;
101
    $holds->delete;
98
102
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
99
};
103
};
100
104
101
subtest 'waiting_or_in_transit' => sub {
105
subtest 'waiting_or_in_transit' => sub {
102
- 

Return to bug 37651