X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fmulti_create%2Fmultilev_single_PKeqFK.t;h=ef5c9a88a0f2ebd6c6c9e5014350b134196a36f3;hb=fecb38cba68186d579ef96f89bf6ce557e55ab1c;hp=c1c7c1cd6191b48dee5351a224682720fd37f684;hpb=cc9d96d02d84dd73db40b17d77739321fd354465;p=dbsrgits%2FDBIx-Class.git diff --git a/t/multi_create/multilev_single_PKeqFK.t b/t/multi_create/multilev_single_PKeqFK.t index c1c7c1c..ef5c9a8 100644 --- a/t/multi_create/multilev_single_PKeqFK.t +++ b/t/multi_create/multilev_single_PKeqFK.t @@ -8,8 +8,6 @@ use DBICTest; sub mc_diag { diag (@_) if $ENV{DBIC_MULTICREATE_DEBUG} }; -plan tests => 16; - my $schema = DBICTest->init_schema(); mc_diag (<<'DG'); @@ -30,8 +28,30 @@ my $rels = { might_have => 'artwork', }; -my $artist_rs = $schema->resultset('Artist'); +for my $type (qw/has_one might_have/) { + + lives_ok (sub { + + my $rel = $rels->{$type}; + my $cd_title = "Simple test $type cd"; + + my $cd = $schema->resultset('CD')->create ({ + artist => 1, + title => $cd_title, + year => 2008, + $rel => {}, + }); + + isa_ok ($cd, 'DBICTest::CD', 'Main CD object created'); + is ($cd->title, $cd_title, 'Correct CD title'); + isa_ok ($cd->$rel, 'DBICTest::Artwork', 'Related artwork present'); + ok ($cd->$rel->in_storage, 'And in storage'); + + }, "Simple $type creation"); +} + +my $artist_rs = $schema->resultset('Artist'); for my $type (qw/has_one might_have/) { my $rel = $rels->{$type}; @@ -80,4 +100,4 @@ for my $type (qw/has_one might_have/) { }, "multilevel $type with a PK == FK in the $type/has_many table ok"); } -1; +done_testing;