X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fmulti_create%2Fexisting_in_chain.t;h=292dd6b7c4a7adca3885fd3fc7165592bc8e1d8d;hb=refs%2Fheads%2Fcurrent%2Fdq;hp=825fad414092e1daec2f7e733c223ffd2b4566df;hpb=58e39c86d4038e950992c1f10ef350c035fffd4e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/multi_create/existing_in_chain.t b/t/multi_create/existing_in_chain.t index 825fad4..292dd6b 100644 --- a/t/multi_create/existing_in_chain.t +++ b/t/multi_create/existing_in_chain.t @@ -13,7 +13,7 @@ my $schema = DBICTest->init_schema(); # even if the preceeding relationship already exists. # # To get this to work a minor rewrite of find() is necessary, and -# more importantly some sort of recursive_insert() call needs to +# more importantly some sort of recursive_insert() call needs to # be available. The way things will work then is: # *) while traversing the hierarchy code calls find_or_create() # *) this in turn calls find(%\nested_dataset) @@ -28,35 +28,37 @@ my $schema = DBICTest->init_schema(); # # ribasushi -TODO: { my $f = __FILE__; local $TODO = "See comment at top of $f for discussion of the TODO"; +my $TODO_msg = "See comment at top of @{[ __FILE__ ]} for discussion of the TODO"; { my $counts; $counts->{$_} = $schema->resultset($_)->count for qw/Track CD Genre/; - lives_ok (sub { - my $existing_nogen_cd = $schema->resultset('CD')->search ( - { 'genre.genreid' => undef }, - { join => 'genre' }, - )->first; - - $schema->resultset('Track')->create ({ - title => 'Sugar-coated', - cd => { - title => $existing_nogen_cd->title, - genre => { - name => 'sugar genre', - } + my $existing_nogen_cd = $schema->resultset('CD')->search ( + { 'genre.genreid' => undef }, + { join => 'genre' }, + )->first; + + $schema->resultset('Track')->create ({ + title => 'Sugar-coated', + cd => { + title => $existing_nogen_cd->title, + genre => { + name => 'sugar genre', } - }); + } + }); - is ($schema->resultset('Track')->count, $counts->{Track} + 1, '1 new track'); - is ($schema->resultset('CD')->count, $counts->{CD}, 'No new cds'); - is ($schema->resultset('Genre')->count, $counts->{Genre} + 1, '1 new genre'); + is ($schema->resultset('Track')->count, $counts->{Track} + 1, '1 new track'); + is ($schema->resultset('CD')->count, $counts->{CD}, 'No new cds'); + TODO: { + todo_skip $TODO_msg, 1; + is ($schema->resultset('Genre')->count, $counts->{Genre} + 1, '1 new genre'); is ($existing_nogen_cd->genre->title, 'sugar genre', 'Correct genre assigned to CD'); - }, 'create() did not throw'); + } } + { my $counts; $counts->{$_} = $schema->resultset($_)->count for qw/Artist CD Producer/; @@ -89,6 +91,8 @@ TODO: { my $f = __FILE__; local $TODO = "See comment at top of $f for discussion is ($schema->resultset('Artist')->count, $counts->{Artist}, 'No new artists'); is ($schema->resultset('Producer')->count, $counts->{Producer} + 1, '1 new producers'); + + local $TODO = $TODO_msg; is ($schema->resultset('CD')->count, $counts->{CD} + 2, '2 new cds'); is ($producer->cds->count, 2, 'CDs assigned to correct producer'); @@ -100,6 +104,4 @@ TODO: { my $f = __FILE__; local $TODO = "See comment at top of $f for discussion }, 'create() did not throw'); } -} - done_testing;