From: Peter Rabbitson Date: Thu, 16 Oct 2008 18:29:38 +0000 (+0000) Subject: Failing tests for multicreate over m2m (passes with 0.08010) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bbbf67ebc98b6b38bfef224e7030690f32e6c42d;p=dbsrgits%2FDBIx-Class-Historic.git Failing tests for multicreate over m2m (passes with 0.08010) --- diff --git a/t/96multi_create.t b/t/96multi_create.t index e27c9cd..ba1fe07 100644 --- a/t/96multi_create.t +++ b/t/96multi_create.t @@ -217,3 +217,21 @@ eval { $t->insert; }; like($@, qr/cd.artist may not be NULL/, "Exception propogated properly"); + +# Test multi create over many_to_many +eval { + $schema->resultset('CD')->create ({ + artist => $new_artist, + title => 'Warble Marble', + year => '2009', + cd_to_producer => [ + { producer => { name => 'Cowboy Neal' } }, + ], + }); + + my $m2m_cd = $schema->resultset('CD')->search ({ title => 'Warble Marble'}); + is ($m2m_cd->count, 1, 'One CD object created via M2M create'); + is ($m2m_cd->first->producers->count, 1, 'CD object created with one producer'); + is ($m2m_cd->first->producers->first->name, 'Cowboy Neal', 'Correct producer object created'); +}; +ok (! $@, 'No exceptions on m2m create');