From c28d8f0600806f9930d115b2fdbccc21f5e86436 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 16 Sep 2018 09:49:46 -0700 Subject: [PATCH] Bug 21360: Prevent IssueSlip.t to fail when run at 23:59 Not sure what happened on bug 15029 (Make the IssueSlip tests pass even if launched after 23:00) but we should have tested with 23:59, not 23:50... koha_1 | # Looks like you planned 3 tests but ran 2. koha_1 | koha_1 | # Failed test 'Issue slip' koha_1 | # at t/db_dependent/Members/IssueSlip.t line 294. koha_1 | Label not found for "last SKIP" at /usr/share/perl5/Test/More.pm line 1370. koha_1 | # Looks like your test exited with 255 just after 1. koha_1 | [23:59:10] t/db_dependent/Members/IssueSlip.t koha_1 | Dubious, test returned 255 (wstat 65280, 0xff00) koha_1 | Failed 3/3 subtests Test plan: 0/ Don't apply this patch 1/ sudo date -s "2018-09-15 23:59:00";prove t/db_dependent/Members/IssueSlip.t => You should get the error 2/ Apply this patch and repeat 1. => Tests should pass now! Signed-off-by: Nick Clemens (cherry picked from commit 60788555b3d79902ccef9f20cf76d4c764efcba0) Signed-off-by: Martin Renvoize --- t/db_dependent/Members/IssueSlip.t | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/Members/IssueSlip.t b/t/db_dependent/Members/IssueSlip.t index bfab08c8af..d34faac6bf 100644 --- a/t/db_dependent/Members/IssueSlip.t +++ b/t/db_dependent/Members/IssueSlip.t @@ -145,8 +145,11 @@ EOS }; subtest 'Daily loans' => sub { - plan tests => 2; - skip "It's 23:59!", 2 if $today->hour == 23 and $today->minute == 59; + if ( $today->hour == 23 and $today->minute == 59 ) { + plan skip_all => "It's 23:59!"; + } else { + plan tests => 2; + } # Test 1: No overdue my $today_daily = $today->clone->set( hour => 23, minute => 59 ); my $today_daily_as_formatted = output_pref( $today_daily ); @@ -219,8 +222,11 @@ EOS }; subtest 'Hourly loans' => sub { - plan tests => 2; - skip "It's 23:59!", 2 if $today->hour == 23 and $today->minute == 59; + if ( $today->hour == 23 and $today->minute == 59 ) { + plan skip_all => "It's 23:59!"; + } else { + plan tests => 2; + } # Test 1: No overdue my ( $date_due_in_time, $date_due_in_time_as_formatted, $date_due_in_late, $date_due_in_late_as_formatted, $issue_date, $slip, $expected_slip ); # Assuming today is not hour = 23 and minute = 59 @@ -307,8 +313,11 @@ EOS }; subtest 'Daily loans' => sub { - plan tests => 2; - skip "It's 23:59!", 2 if $today->hour == 23 and $today->minute == 59; + if ( $today->hour == 23 and $today->minute == 59 ) { + plan skip_all => "It's 23:59!"; + } else { + plan tests => 2; + } # Test 1: No overdue my $today_daily = $today->clone->set( hour => 23, minute => 59 ); my $today_daily_as_formatted = output_pref( $today_daily ); -- 2.39.5