fixed sql mistakes from hierarchical query tests
[dbsrgits/DBIx-Class.git] / t / 82cascade_copy.t
CommitLineData
333cce60 1use strict;
70350518 2use warnings;
333cce60 3
70350518 4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7
a47e1233 8my $schema = DBICTest->init_schema();
333cce60 9
10plan tests => 4;
11my $artist = $schema->resultset('Artist')->find(1);
12my $artist_cds = $artist->search_related('cds');
83419ec6 13
149f24a3 14my $cover_band = $artist->copy;
83419ec6 15
333cce60 16my $cover_cds = $cover_band->search_related('cds');
17cmp_ok($cover_band->id, '!=', $artist->id, 'ok got new column id...');
18is($cover_cds->count, $artist_cds->count, 'duplicated rows count ok');
19
20#check multi-keyed
21cmp_ok($cover_band->search_related('twokeys')->count, '>', 0, 'duplicated multiPK ok');
22
23#and check copying a few relations away
24cmp_ok($cover_cds->search_related('tags')->count, '==',
25 $artist_cds->search_related('tags')->count , 'duplicated count ok');
26