Lines 1-7
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
use Test::More tests => 2; |
4 |
use Test::More tests => 3; |
5 |
|
5 |
|
6 |
use t::lib::Mocks; |
6 |
use t::lib::Mocks; |
7 |
use t::lib::TestBuilder; |
7 |
use t::lib::TestBuilder; |
Lines 161-166
subtest 'Test handling of waiting reserves by CancelExpiredReserves' => sub {
Link Here
|
161 |
CancelExpiredReserves(); |
161 |
CancelExpiredReserves(); |
162 |
my $count2 = Koha::Holds->search->count; |
162 |
my $count2 = Koha::Holds->search->count; |
163 |
is( $count2, 1, 'Also the waiting expired hold should be cancelled now'); |
163 |
is( $count2, 1, 'Also the waiting expired hold should be cancelled now'); |
|
|
164 |
|
165 |
}; |
166 |
|
167 |
subtest 'Test handling of in transit reserves by CancelExpiredReserves' => sub { |
168 |
plan tests => 2; |
169 |
|
170 |
my $builder = t::lib::TestBuilder->new(); |
171 |
|
172 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelay', 1 ); |
173 |
my $expdate = dt_from_string->add( days => -2 ); |
174 |
my $reserve = $builder->build({ |
175 |
source => 'Reserve', |
176 |
value => { |
177 |
expirationdate => '2018-01-01', |
178 |
found => 'T', |
179 |
cancellationdate => undef, |
180 |
suspend => 0, |
181 |
suspend_until => undef |
182 |
} |
183 |
}); |
184 |
my $count = Koha::Holds->search->count; |
185 |
CancelExpiredReserves(); |
186 |
is(Koha::Holds->search->count, $count-1, "Transit hold is cancelled if ExpireReservesMaxPickUpDelay set"); |
187 |
|
188 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelay', 0 ); |
189 |
my $reserve2 = $builder->build({ |
190 |
source => 'Reserve', |
191 |
value => { |
192 |
expirationdate => '2018-01-01', |
193 |
found => 'T', |
194 |
cancellationdate => undef, |
195 |
suspend => 0, |
196 |
suspend_until => undef |
197 |
} |
198 |
}); |
199 |
CancelExpiredReserves(); |
200 |
is(Koha::Holds->search->count, $count-1, "Transit hold is cancelled if ExpireReservesMaxPickUpDelay unset"); |
201 |
|
164 |
}; |
202 |
}; |
165 |
|
203 |
|
166 |
$schema->storage->txn_rollback; |
204 |
$schema->storage->txn_rollback; |
167 |
- |
|
|