From 411f1ea960123135051712c81467cffae785ac33 Mon Sep 17 00:00:00 2001 From: Mason James Date: Sun, 29 Jan 2017 00:47:20 +1300 Subject: [PATCH] Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59 to test patch... 1/ set date between 00:00 and 00:59 $ sudo date -s 'Sun Jan 29 00:41:55 NZDT 2017' 2/ run prove, see fail $ prove -v t/db_dependent/Members/IssueSlip.t ... t/db_dependent/Members/IssueSlip.t (Wstat: 65280 Tests: 1 Failed: 0) Result: FAIL 3/ apply patch 4/ run prove, see pass $ prove -v t/db_dependent/Members/IssueSlip.t ... All tests successful. Result: PASS NOTE: for code obscurity you could have also done a modulus 24. ;) Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart --- t/db_dependent/Members/IssueSlip.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Members/IssueSlip.t b/t/db_dependent/Members/IssueSlip.t index 23340fe..c8135bc 100644 --- a/t/db_dependent/Members/IssueSlip.t +++ b/t/db_dependent/Members/IssueSlip.t @@ -250,7 +250,7 @@ EOS $date_due_in_time_as_formatted = output_pref( $date_due_in_time ); $issue_date = $date_due_in_time->clone->subtract_duration( DateTime::Duration->new( minutes => 1 ) ); AddIssue( $borrower, $barcode1, $date_due_in_time, undef, $issue_date ); - $date_due_in_late = $today->clone->set(hour => $today->hour - 1); + $date_due_in_late = $today->clone->subtract( hours => 1 ); $date_due_in_late_as_formatted = output_pref( $date_due_in_late ); $issue_date = $yesterday->clone; AddIssue( $borrower, $barcode2, $date_due_in_late, undef, $issue_date ); @@ -374,7 +374,7 @@ EOS $date_due_in_time_as_formatted = output_pref( $date_due_in_time ); $issue_date = $date_due_in_time->clone->subtract_duration( DateTime::Duration->new( minutes => 1 ) ); AddIssue( $borrower, $barcode1, $date_due_in_time, undef, $issue_date ); - $date_due_in_late = $today->clone->set(hour => $today->hour - 1); + $date_due_in_late = $today->clone->subtract( hours => 1 ); $date_due_in_late_as_formatted = output_pref( $date_due_in_late ); $issue_date = $yesterday->clone; AddIssue( $borrower, $barcode2, $date_due_in_late, undef, $issue_date ); -- 2.9.3