added cascade_copy relationship attribute
[dbsrgits/DBIx-Class.git] / t / run / 22cascade_copy.tl
CommitLineData
333cce60 1use strict;
2use warnings;
3
4sub run_tests {
5my $schema = shift;
6
7plan tests => 4;
8my $artist = $schema->resultset('Artist')->find(1);
9my $artist_cds = $artist->search_related('cds');
10my $cover_band = $artist->copy;
11my $cover_cds = $cover_band->search_related('cds');
12cmp_ok($cover_band->id, '!=', $artist->id, 'ok got new column id...');
13is($cover_cds->count, $artist_cds->count, 'duplicated rows count ok');
14
15#check multi-keyed
16cmp_ok($cover_band->search_related('twokeys')->count, '>', 0, 'duplicated multiPK ok');
17
18#and check copying a few relations away
19cmp_ok($cover_cds->search_related('tags')->count, '==',
20 $artist_cds->search_related('tags')->count , 'duplicated count ok');
21
22}
231;