Switch CDBICompat and its tests to OptDeps
[dbsrgits/DBIx-Class.git] / t / cdbi / has_many_loads_foreign_class.t
index 51cec5d..5485972 100644 (file)
@@ -1,20 +1,17 @@
-use strict;
-use Test::More;
-use Class::Inspector ();
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
 
-BEGIN {
-  eval "use DBIx::Class::CDBICompat;";
-  plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
-  plan tests => 3;
-}
+use strict;
+use warnings;
 
+use Test::More;
 
 use lib 't/cdbi/testlib';
 use Director;
 
-# Test that has_many() will load the foreign class.
+# Test that has_many() will load the foreign class
+require Class::Inspector;
 ok !Class::Inspector->loaded( 'Film' );
-ok eval { Director->has_many( films => 'Film' ); 1; } || diag $@;
+ok eval { Director->has_many( films => 'Film' ); 1; } or diag $@;
 
 my $shan_hua = Director->create({
     Name    => "Shan Hua",
@@ -33,4 +30,6 @@ my $guillotine = Film->create({
     Director    => "Yu Wang",
 });
 
-is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2];
\ No newline at end of file
+is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2];
+
+done_testing;