Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / cdbi / 68-inflate_has_a.t
index fbb4233..6398494 100644 (file)
@@ -1,16 +1,11 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( ic_dt cdbicompat );
+
 use strict;
 use warnings;
-use Test::More;
 
-BEGIN {
-  eval "use DBIx::Class::CDBICompat; use DateTime 0.55; use Clone;";
-  plan skip_all => "Clone, DateTime 0.55, Class::Trigger and DBIx::ContextualFetch required"
-    if $@;
-}
-
-plan tests => 6;
+use Test::More;
 
-use lib qw(t/lib);
 use DBICTest;
 
 my $schema = DBICTest->init_schema();
@@ -21,7 +16,7 @@ DBICTest::Schema::CD->has_a( 'year', 'DateTime',
       inflate => sub { DateTime->new( year => shift ) },
       deflate => sub { shift->year }
 );
-Class::C3->reinitialize;
+Class::C3->reinitialize if DBIx::Class::_ENV_::OLD_MRO;
 
 # inflation test
 my $cd = $schema->resultset("CD")->find(3);
@@ -59,3 +54,4 @@ $cd->update;
 ($cd) = $schema->resultset("CD")->search({ year => $now->year });
 is( $cd->year->year, $now->year, 'deflate ok' );
 
+done_testing;