fix loading checks
[dbsrgits/DBIx-Class.git] / t / cdbi-t / 24-meta_info.t
index b7301f9..2545111 100644 (file)
@@ -1,15 +1,32 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Test::More tests => 12;
+use Test::More;
+
+BEGIN {
+  eval "use DBIx::Class::CDBICompat;";
+  plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
+    if $@;
+
+  plan skip_all => "Time::Piece required for this test"
+    unless eval { require Time::Piece };
+
+  plan tests => 12;
+}
+
 use Test::Warn;
 
 package Temp::DBI;
 use base qw(DBIx::Class::CDBICompat);
 Temp::DBI->columns(All => qw(id date));
-Temp::DBI->has_a( date => 'Time::Piece', inflate => sub { 
-       Time::Piece->strptime(shift, "%Y-%m-%d") 
-});
+
+my $strptime_inflate = sub { 
+    Time::Piece->strptime(shift, "%Y-%m-%d") 
+};
+Temp::DBI->has_a(
+    date => 'Time::Piece',
+    inflate => $strptime_inflate
+);
 
 
 package Temp::Person;
@@ -47,15 +64,11 @@ package main;
 
 {
     my $owners = Temp::Pet->meta_info( has_many => 'owners' );
-    warning_like {
-        local $TODO = 'args is unlikely to ever work';
-
-        is_deeply $owners->args, {
-            foreign_key     => 'pet',
-            mapping         => [],
-            order_by        => undef
-        };
-    } qr/^\Qargs() is unlikely to ever work/;
+
+    is_deeply $owners->args, {
+        foreign_key     => 'pet',
+        mapping         => [],
+    };
 }
 
 {
@@ -63,4 +76,5 @@ package main;
     is $date->class,            'Temp::DBI';
     is $date->foreign_class,    'Time::Piece';
     is $date->accessor,         'date';
+    is $date->args->{inflate},  $strptime_inflate;
 }