From: Luke Saunders Date: Sun, 11 May 2008 18:43:58 +0000 (+0000) Subject: added test for find or create related functionality in nested inserts X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=38c03c208e9dd1b5800a652fa5a9056988add065;p=dbsrgits%2FDBIx-Class-Historic.git added test for find or create related functionality in nested inserts --- diff --git a/t/96multi_create.t b/t/96multi_create.t index a6394cf..0cbc9bf 100644 --- a/t/96multi_create.t +++ b/t/96multi_create.t @@ -196,6 +196,20 @@ my $new_cd = $schema->resultset("CD")->create($new_cd_hashref); is($new_cd->artist->id, 17, 'new id retained okay'); +# Test find or create related functionality +my $new_artist = $schema->resultset("Artist")->create({ artistid => 18, name => 'larry' }); +my $new_cd_hashref2 = { + cdid => 28, + title => 'Boogie Wiggle', + year => '2007', + artist => { artistid => 18, name => 'larry' } + }; + +eval { + $schema->resultset("CD")->create($new_cd_hashref2); +}; +is($@, '', 'new artist created without clash'); + # Make sure exceptions from errors in created rels propogate eval { my $t = $schema->resultset("Track")->new({});