From: Peter Rabbitson Date: Thu, 11 Jun 2009 14:54:09 +0000 (+0000) Subject: Another multicreate failing test - has_many should not do find_or_create X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=49377893677d11e23e6744198378116fa7c1a1ef;p=dbsrgits%2FDBIx-Class-Historic.git Another multicreate failing test - has_many should not do find_or_create --- diff --git a/t/multi_create/has_many.t b/t/multi_create/has_many.t new file mode 100644 index 0000000..2d6818e --- /dev/null +++ b/t/multi_create/has_many.t @@ -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");