Bug 9142 - Remove the use of subtests
authorTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 26 Nov 2012 13:39:51 +0000 (10:39 -0300)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Wed, 28 Nov 2012 12:19:34 +0000 (07:19 -0500)
Debian stable's version of Test::More is older than the one I used on my
12.04 dev box, and doesn't support subtests, which I used to avoid side
effects between different test scenarios.

This patch removes that subtest definition.

Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
t/Calendar.t

index d6972d0..42b8342 100755 (executable)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use DateTime;
 use DateTime::Duration;
-use Test::More tests => 22;
+use Test::More tests => 26;
 use Koha::DateUtils;
 
 BEGIN {
@@ -127,9 +127,9 @@ my $one_day_dur = DateTime::Duration->new( days => 1 );
 my $two_day_dur = DateTime::Duration->new( days => 2 );
 my $seven_day_dur = DateTime::Duration->new( days => 7 );
 
-subtest '\'Datedue\' tests' => sub {
-    my $cal = Koha::Calendar->new( TEST_MODE => 1 ,
-                                   days_mode => 'Datedue');
+    ## 'Datedue' tests
+    $cal = Koha::Calendar->new( TEST_MODE => 1 ,
+                                days_mode => 'Datedue');
 
     $cal->add_holiday( dt_from_string('2012-07-04','iso') );
     $dt = dt_from_string( '2012-07-03','iso' );
@@ -145,12 +145,12 @@ subtest '\'Datedue\' tests' => sub {
     cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ), 'eq',
         '2012-07-30T11:53:00',
         'Add 7 days (Datedue)' );
-};
 
 
-subtest '\'Calendar\' tests' => sub {
-    my $cal = Koha::Calendar->new( TEST_MODE => 1,
-                                   days_mode => 'Calendar' );
+
+    ## 'Calendar' tests'
+    $cal = Koha::Calendar->new( TEST_MODE => 1,
+                                days_mode => 'Calendar' );
 
     $cal->add_holiday( dt_from_string('2012-07-04','iso') );
     $dt = dt_from_string('2012-07-03','iso');
@@ -162,12 +162,12 @@ subtest '\'Calendar\' tests' => sub {
     cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ), 'eq',
        '2012-07-31T11:53:00',
        'Add 7 days (Calendar)' );
-};
 
 
-subtest '\'Days\' tests' => sub {
-    my $cal = Koha::Calendar->new( TEST_MODE => 1,
-                                   days_mode => 'Days' );
+
+    ## 'Days' tests
+    $cal = Koha::Calendar->new( TEST_MODE => 1,
+                                days_mode => 'Days' );
 
     $cal->add_holiday( dt_from_string('2012-07-04','iso') );
     $dt = dt_from_string('2012-07-03','iso');
@@ -179,4 +179,3 @@ subtest '\'Days\' tests' => sub {
     cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ),'eq',
         '2012-07-30T11:53:00',
         'Add 7 days (Days)' );
-};