[Bast-commits] r6623 - DBIx-Class/0.08/branches/mc_fixes/t/multi_create

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu Jun 11 14:54:09 GMT 2009


Author: ribasushi
Date: 2009-06-11 14:54:09 +0000 (Thu, 11 Jun 2009)
New Revision: 6623

Added:
   DBIx-Class/0.08/branches/mc_fixes/t/multi_create/has_many.t
Log:
Another multicreate failing test - has_many should not do find_or_create

Added: DBIx-Class/0.08/branches/mc_fixes/t/multi_create/has_many.t
===================================================================
--- DBIx-Class/0.08/branches/mc_fixes/t/multi_create/has_many.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/mc_fixes/t/multi_create/has_many.t	2009-06-11 14:54:09 UTC (rev 6623)
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+use lib qw(t/lib);
+use DBICTest;
+
+plan tests => 2;
+
+my $schema = DBICTest->init_schema();
+
+my $track_no_lyrics = $schema->resultset ('Track')
+              ->search ({ 'lyrics.lyric_id' => undef }, { join => 'lyrics' })
+                ->first;
+
+my $lyric = $track_no_lyrics->create_related ('lyrics', {
+  lyric_versions => [
+    { text => 'english doubled' },
+    { text => 'english doubled' },
+  ],
+});
+is ($lyric->lyric_versions->count, 2, "Two identical has_many's created");
+
+
+my $link = $schema->resultset ('Link')->create ({
+  url => 'lolcats!',
+  bookmarks => [
+    {},
+    {},
+  ]
+});
+is ($link->bookmarks->count, 2, "Two identical default-insert has_many's created");




More information about the Bast-commits mailing list