|
Lines 239-245
subtest 'estimated_delivery_date' => sub {
Link Here
|
| 239 |
$schema->storage->txn_rollback; |
239 |
$schema->storage->txn_rollback; |
| 240 |
}; |
240 |
}; |
| 241 |
|
241 |
|
| 242 |
subtest 'late_since_days' => sub { |
242 |
subtest 'days_late() tests' => sub { |
|
|
243 |
|
| 243 |
plan tests => 3; |
244 |
plan tests => 3; |
| 244 |
|
245 |
|
| 245 |
$schema->storage->txn_begin; |
246 |
$schema->storage->txn_begin; |
|
Lines 251-263
subtest 'late_since_days' => sub {
Link Here
|
| 251 |
|
252 |
|
| 252 |
my $now = dt_from_string; |
253 |
my $now = dt_from_string; |
| 253 |
$basket->closedate(undef)->store; # Basket is open |
254 |
$basket->closedate(undef)->store; # Basket is open |
| 254 |
is( $basket->late_since_days, undef, 'return undef if basket is still open' ); |
255 |
is( $basket->days_late, undef, 'return undef if basket is still open' ); |
| 255 |
|
256 |
|
| 256 |
$basket->closedate($now)->store; #Closing the basket today |
257 |
$basket->closedate($now)->store; #Closing the basket today |
| 257 |
is( $basket->late_since_days, 0, 'return 0 if basket has been closed on today' ); |
258 |
is( $basket->days_late, 0, 'return 0 if basket has been closed on today' ); |
| 258 |
|
259 |
|
| 259 |
$basket->closedate( $now->clone->subtract( days => 2 ) )->store; |
260 |
$basket->closedate( $now->clone->subtract( days => 2 ) )->store; |
| 260 |
is( $basket->late_since_days, 2, 'return 2 if basket has been closed 2 days ago' ); |
261 |
is( $basket->days_late, 2, 'return 2 if basket has been closed 2 days ago' ); |
| 261 |
|
262 |
|
| 262 |
$schema->storage->txn_rollback; |
263 |
$schema->storage->txn_rollback; |
| 263 |
}; |
264 |
}; |
| 264 |
- |
|
|