Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / t / cdbi / 04-lazy.t
index 6c9a8d3..96d5743 100644 (file)
@@ -1,5 +1,9 @@
+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;
 
@@ -7,18 +11,8 @@ use Test::Warn;
 # Test lazy loading
 #----------------------------------------------------------------------
 
-BEGIN {
-  eval "use DBIx::Class::CDBICompat;";
-  plan $@ 
-    ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required')
-    : (tests => 36)
-  ;
-}
-
-INIT {
-  use lib 't/cdbi/testlib';
-  use Lazy;
-}
+use lib 't/cdbi/testlib';
+use Lazy;
 
 is_deeply [ Lazy->columns('Primary') ],        [qw/this/],      "Pri";
 is_deeply [ sort Lazy->columns('Essential') ], [qw/opop this/], "Essential";
@@ -110,20 +104,20 @@ warning_like {
     }, undef, 23, $l->this);
 
     is $l->oop, 23;
-    
+
     $l->delete;
 }
 
 
 # Now again for inflated values
 SKIP: {
-    skip "Requires Date::Simple 3.03", 5 unless eval "use Date::Simple 3.03; 1; ";
+    DBIx::Class::Optional::Dependencies->skip_without( 'Date::Simple>=3.03' );
     Lazy->has_a(
         orp     => 'Date::Simple',
         inflate => sub { Date::Simple->new($_[0] . '-01-01') },
         deflate => 'format'
     );
-    
+
     my $l = Lazy->create({
         this => 89,
         that => 2,
@@ -135,13 +129,13 @@ SKIP: {
         SET    orp  = ?
         WHERE  this = ?
     }, undef, 1987, $l->this);
-    
+
     is $l->orp, '1987-01-01';
 
     $l->orp(2007);
     is $l->orp, '2007-01-01';   # make sure it's inflated
     $l->update;
-    
+
     ok $l->db_Main->do(qq{
         UPDATE @{[ $l->table ]}
         SET    orp  = ?
@@ -149,7 +143,7 @@ SKIP: {
     }, undef, 1942, $l->this);
 
     is $l->orp, '1942-01-01';
-    
+
     $l->delete;
 }
 
@@ -163,19 +157,21 @@ SKIP: {
         oop  => 3,
         opop => 4,
     });
-    
+
     # Delete the object without it knowing.
     Lazy->db_Main->do(qq[
         DELETE
         FROM   @{[ Lazy->table ]}
         WHERE  this = 99
     ]);
-    
+
     $l->eep;
-    
+
     # The problem was when an object had an inflated object
     # loaded.  _flesh() would set _column_data to undef and
     # get_column() would think nothing was there.
     # I'm too lazy to set up the proper inflation test.
     ok !exists $l->{_column_data}{orp};
 }
+
+done_testing;