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 => 74;
10
use Test::More tests => 75;
11
use Test::Exception;
11
use Test::Exception;
12
12
13
use MARC::Record;
13
use MARC::Record;
Lines 1887-1889 subtest 'EmailPatronWhenHoldIsPlaced tests' => sub { Link Here
1887
1887
1888
    $schema->storage->txn_rollback;
1888
    $schema->storage->txn_rollback;
1889
};
1889
};
1890
1891
subtest 'current_holds with future holds' => sub {
1892
    plan tests => 2;
1893
    $schema->storage->txn_begin;
1894
1895
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 );
1896
    my $item    = $builder->build_sample_item;
1897
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
1898
    my $hold_id = AddReserve(
1899
        {
1900
            reservation_date => dt_from_string()->add( days => 1 ),
1901
            branchcode       => $item->homebranch,
1902
            borrowernumber   => $patron->id,
1903
            biblionumber     => $item->biblionumber,
1904
            itemnumber       => $item->itemnumber,
1905
        }
1906
    );
1907
    is( $item->biblio->current_holds->count, 1, 'Future hold was counted' );
1908
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
1909
    is( $item->biblio->current_holds->count, 0, 'No future hold was counted when ConfirmFutureHolds is zero' );
1910
1911
    $schema->storage->txn_rollback;
1912
};
(-)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