Merge the relationship resolution rework
[dbsrgits/DBIx-Class.git] / t / cdbi / 13-constraint.t
index b5b8f32..bd7bb98 100644 (file)
@@ -1,15 +1,11 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
 use strict;
-use Test::More;
+use warnings;
 
-BEGIN {
-  eval "use DBIx::Class::CDBICompat;";
-  if ($@) {
-    plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
-    next;
-  }
-  eval "use DBD::SQLite";
-  plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 23);
-}
+use Test::More;
+use Test::Exception;
 
 use lib 't/cdbi/testlib';
 use Film;
@@ -67,10 +63,10 @@ ok $fred, "Got fred";
     like $@, qr/fails.*constraint/, "Fails listref constraint";
     my $ok = eval { Film->create({ Rating => 'U' }) };
     is $@, '', "Can create with rating U";
-    SKIP: {
-        skip "No column objects", 2;
-    ok +Film->find_column('rating')->is_constrained, "Rating is constrained";
-    ok +Film->find_column('director')->is_constrained, "Director is not";
+    {
+      local $TODO = "No column objects";
+      lives_ok { Film->find_column('rating')->is_constrained || die } "Rating is constrained";
+      lives_ok { Film->find_column('director')->is_constrained || die } "Director is not";
     }
 }
 
@@ -102,6 +98,8 @@ ok $fred, "Got fred";
     is $freeaa && $freeaa->codirector, '2001-03-03', "Set the codirector";
 }
 
+done_testing;
+
 __DATA__
 
 use CGI::Untaint;
@@ -116,4 +114,3 @@ sub _constrain_by_untaint {
         return 1;
     });
 }
-