Bugzilla – Attachment 95895 Details for
Bug 23974
hours_between and days_between lack tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23974: Add tests for issue on closed day
Bug-23974-Add-tests-for-issue-on-closed-day.patch (text/plain), 3.07 KB, created by
Martin Renvoize (ashimema)
on 2019-12-02 09:23:28 UTC
(
hide
)
Description:
Bug 23974: Add tests for issue on closed day
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-12-02 09:23:28 UTC
Size:
3.07 KB
patch
obsolete
>From f2020f997401b3f2ff2fd8427af2cf3aaf447279 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 2 Dec 2019 09:00:18 +0000 >Subject: [PATCH] Bug 23974: Add tests for issue on closed day > >--- > t/db_dependent/Calendar.t | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Calendar.t b/t/db_dependent/Calendar.t >index 2944e81fff..ac5be32c07 100644 >--- a/t/db_dependent/Calendar.t >+++ b/t/db_dependent/Calendar.t >@@ -199,7 +199,7 @@ subtest 'hours_between | days_between' => sub { > my $calendar = Koha::Calendar->new( branchcode => $library->branchcode ); > > subtest 'Same hours' => sub { >- plan tests => 10; >+ plan tests => 12; > > my ( $diff_hours, $diff_days ); > >@@ -209,10 +209,16 @@ subtest 'hours_between | days_between' => sub { > $diff_days = $calendar->days_between( $now, $nov_6)->delta_days; > is( $diff_days, 0, '' ); # FIXME Is this really should be 0? > >+ # Between 6th and 7th (This case should never happen in real code, one cannot issue on a closed day) >+ $diff_hours = $calendar->hours_between( $nov_6, $nov_7 )->hours; >+ is( $diff_hours, 0 * 24, '' ); # FIXME Is this really should be 0? >+ $diff_days = $calendar->days_between( $nov_6, $nov_7 )->delta_days; >+ is( $diff_days, 0, '' ); # FIXME Is this really should be 0? >+ > # Between 5th and 7th > $diff_hours = $calendar->hours_between( $now, $nov_7 )->hours; > is( $diff_hours, 2 * 24 - 1 * 24, '' ); >- $diff_days = $calendar->days_between( $now, $nov_7)->delta_days; >+ $diff_days = $calendar->days_between( $now, $nov_7 )->delta_days; > is( $diff_days, 2 - 1, '' ); > > # Between 5th and 12th >@@ -235,7 +241,7 @@ subtest 'hours_between | days_between' => sub { > }; > > subtest 'Different hours' => sub { >- plan tests => 11; >+ plan tests => 14; > > my ( $diff_hours, $diff_days ); > >@@ -249,6 +255,13 @@ subtest 'hours_between | days_between' => sub { > $duration = $calendar->days_between( $now, $nov_6->clone->subtract(hours => 3) ); > is( $duration->hours, abs(0), '' ); # FIXME Is this correct? > >+ # Between 6th and 7th (This case should never happen in real code, one cannot issue on a closed day) >+ $duration = $calendar->hours_between( $nov_6, $nov_7->clone->subtract(hours => 3) ); >+ is( $duration->hours, abs(0 * 24 - 3), '' ); # FIXME $duration->hours always return a abs >+ is( $duration->is_negative, 1, ); # FIXME Do really test for that case in our calls to hours_between? >+ $duration = $calendar->days_between( $nov_6, $nov_7->clone->subtract(hours => 3) ); >+ is( $duration->hours, abs(0), '' ); # FIXME Is this correct? >+ > # Between 5th and 7th > $diff_hours = $calendar->hours_between( $now, $nov_7->clone->subtract(hours => 3) )->hours; > is( $diff_hours, 2 * 24 - 1 * 24 - 3, '' ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23974
:
95062
|
95063
|
95064
|
95065
|
95210
|
95211
|
95212
|
95213
|
95214
|
95889
|
95890
|
95891
|
95893
|
95894
|
95895
|
95896
|
96778
|
96779
|
96780
|
96781
|
96782
|
96783
|
96784
|
96785
|
96786
|
97129
|
97130
|
97131
|
97132
|
97133
|
97134
|
97135
|
97136
|
97137