X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F82cascade_copy.t;h=505b79b5c71ca8cd3a8d6d34df50094700fb5cda;hb=d8cf3aa31fb3d6ff7813f021fcc002663725fc41;hp=14c4762b9b9fd2c21ce5da0d222597125c0785d7;hpb=84f7e8a1c6303091d753572648e37d3bd7270181;p=dbsrgits%2FDBIx-Class.git diff --git a/t/82cascade_copy.t b/t/82cascade_copy.t index 14c4762..505b79b 100644 --- a/t/82cascade_copy.t +++ b/t/82cascade_copy.t @@ -1,8 +1,10 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; -use lib qw(t/lib); + use DBICTest; my $schema = DBICTest->init_schema(); @@ -17,10 +19,24 @@ cmp_ok($cover_band->id, '!=', $artist->id, 'ok got new column id...'); is($cover_cds->count, $artist_cds->count, 'duplicated rows count ok'); #check multi-keyed -cmp_ok($cover_band->search_related('twokeys')->count, '>', 0, 'duplicated multiPK ok'); +is( + $cover_band->search_related('twokeys')->count, + $artist->search_related('twokeys')->count, + 'duplicated multiPK ok' +); #and check copying a few relations away cmp_ok($cover_cds->search_related('tags')->count, '==', $artist_cds->search_related('tags')->count , 'duplicated count ok'); + +# check from the other side +my $cd = $schema->resultset('CD')->find(1); +my $dup_cd = $cd->copy ({ title => 'ha!' }); +is( + $dup_cd->search_related('twokeys')->count, + $cd->search_related('twokeys')->count, + 'duplicated multiPK ok' +); + done_testing;