Lines 8-14
use Koha::DateUtils;
Link Here
|
8 |
use t::lib::Mocks; |
8 |
use t::lib::Mocks; |
9 |
use t::lib::TestBuilder; |
9 |
use t::lib::TestBuilder; |
10 |
|
10 |
|
11 |
use Test::More tests => 10; |
11 |
use Test::More tests => 11; |
12 |
|
12 |
|
13 |
use_ok('C4::Reserves'); |
13 |
use_ok('C4::Reserves'); |
14 |
|
14 |
|
Lines 77-82
my $biblio3 = $builder->build({
Link Here
|
77 |
title => 'Title 3', }, |
77 |
title => 'Title 3', }, |
78 |
}); |
78 |
}); |
79 |
|
79 |
|
|
|
80 |
my $biblio4 = $builder->build({ |
81 |
source => 'Biblio', |
82 |
value => { |
83 |
title => 'Title 4', }, |
84 |
}); |
85 |
|
80 |
my $item1 = $builder->build({ |
86 |
my $item1 = $builder->build({ |
81 |
source => 'Item', |
87 |
source => 'Item', |
82 |
value => { |
88 |
value => { |
Lines 98-103
my $item3 = $builder->build({
Link Here
|
98 |
}, |
104 |
}, |
99 |
}); |
105 |
}); |
100 |
|
106 |
|
|
|
107 |
my $item4 = $builder->build({ |
108 |
source => 'Item', |
109 |
value => { |
110 |
biblionumber => $biblio4->{biblionumber}, |
111 |
}, |
112 |
}); |
113 |
|
101 |
my $today = dt_from_string(); |
114 |
my $today = dt_from_string(); |
102 |
|
115 |
|
103 |
my $reserve1_reservedate = $today->clone; |
116 |
my $reserve1_reservedate = $today->clone; |
Lines 167-173
my $reserve3 = $builder->build({
Link Here
|
167 |
my $special_holiday1_dt = $today->clone; |
180 |
my $special_holiday1_dt = $today->clone; |
168 |
$special_holiday1_dt->add(days => 2); |
181 |
$special_holiday1_dt->add(days => 2); |
169 |
|
182 |
|
170 |
Koha::Cache->get_instance()->flush_all(); |
|
|
171 |
my $holiday = $builder->build({ |
183 |
my $holiday = $builder->build({ |
172 |
source => 'SpecialHoliday', |
184 |
source => 'SpecialHoliday', |
173 |
value => { |
185 |
value => { |
Lines 205-208
$expected_expiration->add(days => 8);
Link Here
|
205 |
my $r3 = Koha::Holds->find($reserve3->{reserve_id}); |
217 |
my $r3 = Koha::Holds->find($reserve3->{reserve_id}); |
206 |
is($r3->expirationdate, $expected_expiration->ymd, 'Expiration date should be set to today + 7' ); |
218 |
is($r3->expirationdate, $expected_expiration->ymd, 'Expiration date should be set to today + 7' ); |
207 |
|
219 |
|
|
|
220 |
my $reserve4_reservedate = $today->clone; |
221 |
my $requested_expiredate = $today->clone()->add(days => 6); |
222 |
|
223 |
my $reserve4 = $builder->build({ |
224 |
source => 'Reserve', |
225 |
value => { |
226 |
borrowernumber => $patron2->{borrowernumber}, |
227 |
reservedate => $reserve4_reservedate->ymd, |
228 |
expirationdate => $requested_expiredate->ymd, |
229 |
biblionumber => $biblio4->{biblionumber}, |
230 |
branchcode => 'LIB1', |
231 |
priority => 1, |
232 |
found => '', |
233 |
}, |
234 |
}); |
235 |
|
236 |
t::lib::Mocks::mock_preference('ReservesMaxPickUpDelay', 10); |
237 |
ModReserveAffect( $item4->{itemnumber}, $patron2->{borrowernumber}, 0, $reserve4->{reserve_id}); |
238 |
|
239 |
my $r4 = Koha::Holds->find($reserve4->{reserve_id}); |
240 |
is($r4->expirationdate, $requested_expiredate->ymd, 'Requested expiration date should be kept' ); |
241 |
|
208 |
$dbh->rollback; |
242 |
$dbh->rollback; |
209 |
- |
|
|