Commit | Line | Data |
333cce60 |
1 | use strict; |
84f7e8a1 |
2 | use warnings; |
333cce60 |
3 | |
70350518 |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
a47e1233 |
8 | my $schema = DBICTest->init_schema(); |
333cce60 |
9 | |
333cce60 |
10 | my $artist = $schema->resultset('Artist')->find(1); |
11 | my $artist_cds = $artist->search_related('cds'); |
83419ec6 |
12 | |
84f7e8a1 |
13 | my $cover_band = $artist->copy ({name => $artist->name . '_cover' }); |
83419ec6 |
14 | |
333cce60 |
15 | my $cover_cds = $cover_band->search_related('cds'); |
16 | cmp_ok($cover_band->id, '!=', $artist->id, 'ok got new column id...'); |
17 | is($cover_cds->count, $artist_cds->count, 'duplicated rows count ok'); |
18 | |
19 | #check multi-keyed |
20 | cmp_ok($cover_band->search_related('twokeys')->count, '>', 0, 'duplicated multiPK ok'); |
21 | |
22 | #and check copying a few relations away |
23 | cmp_ok($cover_cds->search_related('tags')->count, '==', |
24 | $artist_cds->search_related('tags')->count , 'duplicated count ok'); |
25 | |
84f7e8a1 |
26 | done_testing; |