[Bast-commits] r5607 - in DBIx-Class/0.08/trunk: lib/DBIx/Class t

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Fri Feb 20 18:12:38 GMT 2009


Author: matthewt
Date: 2009-02-20 18:12:38 +0000 (Fri, 20 Feb 2009)
New Revision: 5607

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/trunk/t/96multi_create_new.t
Log:
fix test bug, also: fuck you, multi create

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2009-02-20 17:43:27 UTC (rev 5606)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2009-02-20 18:12:38 UTC (rev 5607)
@@ -290,7 +290,10 @@
       MULTICREATE_DEBUG and warn "MC $self pre-reconstructing $relname $rel_obj\n";
 
       my $them = { %{$rel_obj->{_relationship_data} || {} }, $rel_obj->get_inflated_columns };
-      my $re = $self->find_or_create_related($relname, $them);
+      my $re = $self->result_source
+                    ->related_source($relname)
+                    ->resultset
+                    ->find_or_create($them);
       %{$rel_obj} = %{$re};
       $self->set_from_related($relname, $rel_obj);
       delete $related_stuff{$relname};

Modified: DBIx-Class/0.08/trunk/t/96multi_create_new.t
===================================================================
--- DBIx-Class/0.08/trunk/t/96multi_create_new.t	2009-02-20 17:43:27 UTC (rev 5606)
+++ DBIx-Class/0.08/trunk/t/96multi_create_new.t	2009-02-20 18:12:38 UTC (rev 5607)
@@ -6,7 +6,7 @@
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 9;
+plan tests => 12;
 
 my $schema = DBICTest->init_schema();
 
@@ -36,10 +36,21 @@
 
 {
     my $new_artist = $schema->resultset("Artist")->new_result({ 'name' => 'Depeche Mode' });
-    my $new_related_cd = $new_artist->new_related('cds', { 'title' => 'Leave in Silence', 'year' => 1982});
+    my $new_related_cd = $new_artist->new_related('cds', { 'title' => 'Leave Slightly Noisily', 'year' => 1982});
     eval {
         $new_related_cd->insert;
     };
+    is ($@, '', 'CD insertion survives by finding artist');
+    ok($new_artist->in_storage, 'artist inserted');
+    ok($new_related_cd->in_storage, 'new_related_cd inserted');
+}
+
+{
+    my $new_artist = $schema->resultset("Artist")->new_result({ 'name' => 'Depeche Mode 2: Insertion Boogaloo' });
+    my $new_related_cd = $new_artist->new_related('cds', { 'title' => 'Leave Loudly While Singing Off Key', 'year' => 1982});
+    eval {
+        $new_related_cd->insert;
+    };
     is ($@, '', 'CD insertion survives by inserting artist');
     ok($new_artist->in_storage, 'artist inserted');
     ok($new_related_cd->in_storage, 'new_related_cd inserted');




More information about the Bast-commits mailing list