|
Lines 150-161
subtest 'hours_between | days_between' => sub {
Link Here
|
| 150 |
|
150 |
|
| 151 |
subtest 'Different hours' => sub { |
151 |
subtest 'Different hours' => sub { |
| 152 |
|
152 |
|
| 153 |
plan tests => 8; |
153 |
plan tests => 10; |
|
|
154 |
|
| 155 |
# Between 5th and 5th (Same day short hours loan) |
| 156 |
my $diff_hours = $calendar->hours_between( $now, $now->clone->add(hours => 3) )->hours; |
| 157 |
is( $diff_hours, 3, '' ); |
| 158 |
my $diff_days = $calendar->days_between( $now, $now->clone->add(hours => 3) )->delta_days; |
| 159 |
is( $diff_days, 0, '' ); |
| 154 |
|
160 |
|
| 155 |
# Between 5th and 6th |
161 |
# Between 5th and 6th |
| 156 |
my $diff_hours = $calendar->hours_between( $now, $nov_6->clone->subtract(hours => 3) )->hours; |
162 |
$diff_hours = $calendar->hours_between( $now, $nov_6->clone->subtract(hours => 3) )->hours; |
| 157 |
is( $diff_hours, 1 * 24 - 3, '' ); |
163 |
is( $diff_hours, 1 * 24 - 3, '' ); |
| 158 |
my $diff_days = $calendar->days_between( $now, $nov_6->clone->subtract(hours => 3) )->delta_days; |
164 |
$diff_days = $calendar->days_between( $now, $nov_6->clone->subtract(hours => 3) )->delta_days; |
| 159 |
is( $diff_days, 1, '' ); |
165 |
is( $diff_days, 1, '' ); |
| 160 |
|
166 |
|
| 161 |
# Between 5th and 7th |
167 |
# Between 5th and 7th |
|
Lines 233-238
subtest 'hours_between | days_between' => sub {
Link Here
|
| 233 |
|
239 |
|
| 234 |
my ( $diff_hours, $diff_days ); |
240 |
my ( $diff_hours, $diff_days ); |
| 235 |
|
241 |
|
|
|
242 |
# Between 5th and 5th (Same day short hours loan) |
| 243 |
# No test - one cannot issue on a holiday and we do not yet record opening hours to take those into account |
| 244 |
|
| 236 |
# Between 5th and 6th |
245 |
# Between 5th and 6th |
| 237 |
my $duration = $calendar->hours_between( $now, $nov_6->clone->subtract(hours => 3) ); |
246 |
my $duration = $calendar->hours_between( $now, $nov_6->clone->subtract(hours => 3) ); |
| 238 |
is( $duration->hours, abs(0 * 24 - 3), '' ); # FIXME $duration->hours always return a abs |
247 |
is( $duration->hours, abs(0 * 24 - 3), '' ); # FIXME $duration->hours always return a abs |
| 239 |
- |
|
|