10 my $schema = DBICTest->init_schema();
11 my $cd_rs = $schema->resultset('CD')->search ({}, { rows => 1, order_by => 'cdid' });
13 my $track_count = $cd_rs->first->tracks->count;
15 cmp_ok ($track_count, '>', 1, 'First CD has several tracks');
17 is ($cd_rs->search_related ('tracks')->count, $track_count, 'related->count returns correct number chained off a limited rs');
18 is (scalar ($cd_rs->search_related ('tracks')->all), $track_count, 'related->all returns correct number of objects chained off a limited rs');
21 my $joined_cd_rs = $cd_rs->search ({}, {
22 join => 'tracks', rows => 2, distinct => 1, having => \ 'count(tracks.trackid) > 2',
25 my $multiple_track_count = $schema->resultset('Track')->search ({
26 cd => { -in => $joined_cd_rs->get_column ('cdid')->as_query }
31 $joined_cd_rs->search_related ('tracks')->count,
32 $multiple_track_count,
33 'related->count returns correct number chained off a grouped rs',
36 scalar ($joined_cd_rs->search_related ('tracks')->all),
37 $multiple_track_count,
38 'related->all returns correct number of objects chained off a grouped rs',