|
Lines 202-208
subtest "Tests for repatriate." => sub {
Link Here
|
| 202 |
}; |
202 |
}; |
| 203 |
|
203 |
|
| 204 |
subtest "Tests for needs_advancing." => sub { |
204 |
subtest "Tests for needs_advancing." => sub { |
| 205 |
plan tests => 7; |
205 |
plan tests => 8; |
| 206 |
$schema->storage->txn_begin; |
206 |
$schema->storage->txn_begin; |
| 207 |
|
207 |
|
| 208 |
# Test behaviour of item freshly added to rota. |
208 |
# Test behaviour of item freshly added to rota. |
|
Lines 266-271
subtest "Tests for needs_advancing." => sub {
Link Here
|
| 266 |
dt_from_string() - DateTime::Duration->new( days => 75 ) |
266 |
dt_from_string() - DateTime::Duration->new( days => 75 ) |
| 267 |
)->store; |
267 |
)->store; |
| 268 |
is($dbitem->needs_advancing, 1, "Ready to be advanced."); |
268 |
is($dbitem->needs_advancing, 1, "Ready to be advanced."); |
|
|
269 |
|
| 270 |
# Bug 30518: Confirm that DST boundaries do not explode. |
| 271 |
# mock_config does not work here, because of tz vs timezone subroutines |
| 272 |
my $context = Test::MockModule->new('C4::Context'); |
| 273 |
$context->mock( 'tz', sub { |
| 274 |
'Europe/London'; |
| 275 |
}); |
| 276 |
my $bad_date = dt_from_string("2020-09-29T01:15:30", 'iso'); |
| 277 |
$dbtransfer->datesent($bad_date)->store; |
| 278 |
$dbtransfer->datearrived($bad_date)->store; |
| 279 |
$dbitem->stage->duration(180)->store; |
| 280 |
is( $dbitem->needs_advancing, 1, "DST boundary doesn't cause failure." ); |
| 281 |
$context->unmock('tz'); |
| 282 |
|
| 283 |
# Test that missing historical branch transfers do not crash |
| 269 |
$dbtransfer->delete; |
284 |
$dbtransfer->delete; |
| 270 |
warning_is {$dbitem->needs_advancing} "We have no historical branch transfer for item " . $dbitem->item->itemnumber . "; This should not have happened!", "Missing transfer is warned."; |
285 |
warning_is {$dbitem->needs_advancing} "We have no historical branch transfer for item " . $dbitem->item->itemnumber . "; This should not have happened!", "Missing transfer is warned."; |
| 271 |
|
286 |
|
| 272 |
- |
|
|