fix MySQL tests without InnoDB, use my variables instead of "use constant"
Rafael Kitover [Wed, 24 Feb 2010 12:41:22 +0000 (07:41 -0500)]
lib/DBIx/Class/Schema/Loader/Base.pm
t/lib/dbixcsl_common_tests.pm

index 95906a6..2ab55bd 100644 (file)
@@ -425,9 +425,9 @@ L<DBIx::Class::Schema::Loader>.
 
 =cut
 
-use constant CURRENT_V  => 'v5';
+my $CURRENT_V = 'v5';
 
-use constant CLASS_ARGS => qw(
+my @CLASS_ARGS = qw(
     schema_base_class result_base_class additional_base_classes
     left_base_classes additional_classes components resultset_components
 );
@@ -502,7 +502,7 @@ sub new {
 
     if ($self->naming) {
         for (values %{ $self->naming }) {
-            $_ = CURRENT_V if $_ eq 'current';
+            $_ = $CURRENT_V if $_ eq 'current';
         }
     }
     $self->{naming} ||= {};
@@ -616,7 +616,7 @@ EOF
             my ($v) = $real_ver =~ /([1-9])/;
             $v = "v$v";
 
-            last if $v eq CURRENT_V || $real_ver =~ /^0\.\d\d999/;
+            last if $v eq $CURRENT_V || $real_ver =~ /^0\.\d\d999/;
 
             if (not %{ $self->naming }) {
                 warn <<"EOF" unless $ENV{SCHEMA_LOADER_BACKCOMPAT};
@@ -650,7 +650,7 @@ sub _validate_class_args {
     my $self = shift;
     my $args = shift;
     
-    foreach my $k (CLASS_ARGS) {
+    foreach my $k (@CLASS_ARGS) {
         next unless $self->$k;
 
         my @classes = ref $self->$k eq 'ARRAY' ? @{ $self->$k } : $self->$k;
index e07ce36..b56fcf5 100644 (file)
@@ -63,8 +63,8 @@ sub _custom_column_info {
     $table_name = lc ( $table_name );
     $column_name = lc ( $column_name );
 
-    if ( $table_name eq 'loader_test11' 
-        and $column_name eq 'loader_test10' 
+    if ( $table_name eq 'loader_test35' 
+        and $column_name eq 'an_int' 
     ){
         return { is_numeric => 1 }
     }
@@ -366,7 +366,7 @@ sub test_schema {
     );
 
     SKIP: {
-        skip $self->{skip_rels}, 96 if $self->{skip_rels};
+        skip $self->{skip_rels}, 99 if $self->{skip_rels};
 
         my $moniker3 = $monikers->{loader_test3};
         my $class3   = $classes->{loader_test3};
@@ -635,20 +635,6 @@ sub test_schema {
         ok($class10->column_info('loader_test11')->{is_foreign_key}, 'Foreign key detected');
         ok($class11->column_info('loader_test10')->{is_foreign_key}, 'Foreign key detected');
 
-        # Added by custom_column_info
-        ok($class11->column_info('loader_test10')->{is_numeric}, 'custom_column_info');
-
-        is($class36->column_info('a_date')->{locale},'de_DE','datetime_locale');
-        is($class36->column_info('a_date')->{timezone},'Europe/Berlin','datetime_timezone');
-
-        ok($class36->column_info('b_char_as_data')->{inflate_datetime},'custom_column_info');
-        is($class36->column_info('b_char_as_data')->{locale},'de_DE','datetime_locale');
-        is($class36->column_info('b_char_as_data')->{timezone},'Europe/Berlin','datetime_timezone');
-
-        ok($class36->column_info('c_char_as_data')->{inflate_date},'custom_column_info');
-        is($class36->column_info('c_char_as_data')->{locale},'de_DE','datetime_locale');
-        is($class36->column_info('c_char_as_data')->{timezone},'Europe/Berlin','datetime_timezone');
-
         my $obj10 = $rsobj10->create({ subject => 'xyzzy' });
 
         $obj10->update();
@@ -726,6 +712,25 @@ sub test_schema {
         }
     }
 
+    # test custom_column_info and datetime_timezone/datetime_locale
+    {
+        my $class35 = $classes->{loader_test35};
+        my $class36 = $classes->{loader_test36};
+
+        ok($class35->column_info('an_int')->{is_numeric}, 'custom_column_info');
+
+        is($class36->column_info('a_date')->{locale},'de_DE','datetime_locale');
+        is($class36->column_info('a_date')->{timezone},'Europe/Berlin','datetime_timezone');
+
+        ok($class36->column_info('b_char_as_data')->{inflate_datetime},'custom_column_info');
+        is($class36->column_info('b_char_as_data')->{locale},'de_DE','datetime_locale');
+        is($class36->column_info('b_char_as_data')->{timezone},'Europe/Berlin','datetime_timezone');
+
+        ok($class36->column_info('c_char_as_data')->{inflate_date},'custom_column_info');
+        is($class36->column_info('c_char_as_data')->{locale},'de_DE','datetime_locale');
+        is($class36->column_info('c_char_as_data')->{timezone},'Europe/Berlin','datetime_timezone');
+    }
+
     # rescan and norewrite test
     SKIP: {
         my @statements_rescan = (