Merge the relationship resolution rework
[dbsrgits/DBIx-Class.git] / t / cdbi / columns_as_hashes.t
index 9ae1976..a8953c3 100644 (file)
@@ -1,13 +1,12 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
 use strict;
+use warnings;
+
 use Test::More;
 use Test::Warn;
 
-BEGIN {
-  eval "use DBIx::Class::CDBICompat;";
-  plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
-          : ('no_plan');
-}
-
 use lib 't/cdbi/testlib';
 use Film;
 
@@ -26,7 +25,7 @@ local $ENV{DBIC_CDBICOMPAT_HASH_WARN} = 0;
         my $rating = $waves->{rating};
         $waves->Rating("PG");
         is $rating, "R", 'evaluation of column value is not deferred';
-    } qr{^Column 'rating' of 'Film/$waves' was fetched as a hash at \Q$0};
+    } qr{^Column 'rating' of 'Film/$waves' was fetched as a hash at\b};
 
     warnings_like {
         is $waves->{title}, $waves->Title, "columns can be accessed as hashes";
@@ -53,15 +52,15 @@ warning_is {
 } '', 'DBIC_CDBICOMPAT_HASH_WARN controls warnings';
 
 
-{    
+{
     $waves->rating("R");
     $waves->update;
-    
+
     no warnings 'redefine';
     local *Film::rating = sub {
         return "wibble";
     };
-    
+
     is $waves->{rating}, "R";
 }
 
@@ -74,7 +73,7 @@ warning_is {
         return "movie" if lc $col eq "film";
         return $col;
     };
-    
+
     require Actor;
     Actor->has_a( film => "Film" );
 
@@ -82,7 +81,7 @@ warning_is {
         name    => 'Emily Watson',
         film    => $waves,
     });
-    
+
     ok !eval { $actor->film };
     is $actor->{film}->id, $waves->id,
        'hash access still works despite lack of accessor';
@@ -91,14 +90,16 @@ warning_is {
 
 # Emulate that Class::DBI inflates immediately
 SKIP: {
-    skip "Need MySQL to run this test", 3 unless eval { require MyFoo };
-    
+    DBIx::Class::Optional::Dependencies->skip_without([qw( Date::Simple>=3.03 test_rdbms_mysql )]);
+    require MyFoo;
     my $foo = MyFoo->insert({
         name    => 'Whatever',
         tdate   => '1949-02-01',
     });
     isa_ok $foo, 'MyFoo';
-    
+
     isa_ok $foo->{tdate}, 'Date::Simple';
     is $foo->{tdate}->year, 1949;
-}
\ No newline at end of file
+}
+
+done_testing;