[Bast-commits] r7274 - in DBIx-Class/0.08/branches/multicreate_fixes: . t/multi_create

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun Aug 9 13:23:24 GMT 2009


Author: ribasushi
Date: 2009-08-09 13:23:24 +0000 (Sun, 09 Aug 2009)
New Revision: 7274

Modified:
   DBIx-Class/0.08/branches/multicreate_fixes/Changes
   DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/existing_in_chain.t
Log:
Comment and todoify remaining test - too much of an undertaking / needs discussion

Modified: DBIx-Class/0.08/branches/multicreate_fixes/Changes
===================================================================
--- DBIx-Class/0.08/branches/multicreate_fixes/Changes	2009-08-09 13:22:09 UTC (rev 7273)
+++ DBIx-Class/0.08/branches/multicreate_fixes/Changes	2009-08-09 13:23:24 UTC (rev 7274)
@@ -36,6 +36,7 @@
         - New ::Storage::DBI method last_dbh() - it will still return a
           newly connected $dbh if we start unconnected, but will not ping
           the server on every invocation unlike dbh()
+        - Some fixes of multi-create corner cases
         - Multiple POD improvements
 
 0.08108 2009-07-05 23:15:00 (UTC)

Modified: DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/existing_in_chain.t
===================================================================
--- DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/existing_in_chain.t	2009-08-09 13:22:09 UTC (rev 7273)
+++ DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/existing_in_chain.t	2009-08-09 13:23:24 UTC (rev 7274)
@@ -6,10 +6,30 @@
 use lib qw(t/lib);
 use DBICTest;
 
-plan 'no_plan';
-
 my $schema = DBICTest->init_schema();
 
+# For fully intuitive multicreate any relationships in a chain
+# that do not exist for one reason or another should be created,
+# even if the preceeding relationship already exists.
+#
+# To get this to work a minor rewrite of find() is necessary, and
+# more importantly some sort of recursive_insert() call needs to 
+# be available. The way things will work then is:
+# *) while traversing the hierarchy code calls find_or_create()
+# *) this in turn calls find(%\nested_dataset)
+# *) this should return not only the existing object, but must
+#    also attach all non-existing (in fact maybe existing) related
+#    bits of data to it, with in_storage => 0
+# *) then before returning the result of the succesful find(), we
+#    simply call $obj->recursive_insert and all is dandy
+#
+# Since this will not be a very clean solution, todoifying for the
+# time being until an actual need arises
+#
+# ribasushi
+
+TODO: { my $f = __FILE__; local $TODO = "See comment at top of $f for discussion of the TODO";
+
 {
   my $counts;
   $counts->{$_} = $schema->resultset($_)->count for qw/Track CD Genre/;
@@ -35,9 +55,8 @@
     is ($schema->resultset('Genre')->count, $counts->{Genre} + 1, '1 new genre');
 
     is ($existing_nogen_cd->genre->title,  'sugar genre', 'Correct genre assigned to CD');
-  });
+  }, 'create() did not throw');
 }
-
 {
   my $counts;
   $counts->{$_} = $schema->resultset($_)->count for qw/Artist CD Producer/;
@@ -78,7 +97,9 @@
       [ qw/queen1 queen2/ ],
       'Correct cd names',
     );
-  });
+  }, 'create() did not throw');
 }
 
-1;
+}
+
+done_testing;




More information about the Bast-commits mailing list