[Bast-commits] r4188 - DBIx-Class/0.08/trunk/t/cdbi-t

schwern at dev.catalyst.perl.org schwern at dev.catalyst.perl.org
Thu Mar 13 18:50:32 GMT 2008


Author: schwern
Date: 2008-03-13 18:50:32 +0000 (Thu, 13 Mar 2008)
New Revision: 4188

Modified:
   DBIx-Class/0.08/trunk/t/cdbi-t/04-lazy.t
Log:
Test lazy loading with a deleted object.

Modified: DBIx-Class/0.08/trunk/t/cdbi-t/04-lazy.t
===================================================================
--- DBIx-Class/0.08/trunk/t/cdbi-t/04-lazy.t	2008-03-13 18:49:57 UTC (rev 4187)
+++ DBIx-Class/0.08/trunk/t/cdbi-t/04-lazy.t	2008-03-13 18:50:32 UTC (rev 4188)
@@ -15,7 +15,7 @@
     next;
   }
 	eval "use DBD::SQLite";
-	plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 35);
+	plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 36);
 }
 
 INIT {
@@ -155,3 +155,30 @@
     
     $l->delete;
 }
+
+
+# Test that a deleted object works
+{
+    Lazy->search()->delete_all;
+    my $l = Lazy->create({
+        this => 99,
+        that => 2,
+        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};
+}




More information about the Bast-commits mailing list