12 my $schema = DBICTest->init_schema();
17 $schema->populate ('Artist', [
23 # add 3 extra cds to every artist
24 for my $ar ($schema->resultset ('Artist')->all) {
25 for my $cdnum (1 .. 3) {
26 $ar->create_related ('cds', {
27 title => "bogon $cdnum",
28 year => 2000 + $cdnum,
33 my $cds = $schema->resultset ('CD')->search ({}, { group_by => 'artist' } );
34 is ($cds->count, 5, 'Resultset collapses to 5 groups');
36 my ($pg1, $pg2, $pg3) = map { $cds->search_rs ({}, {rows => 2, page => $_}) } (1..3);
38 for ($pg1, $pg2, $pg3) {
39 is ($_->pager->total_entries, 5, 'Total count via pager correct');
42 is ($pg1->count, 2, 'First page has 2 groups');
43 is ($pg2->count, 2, 'Second page has 2 groups');
44 is ($pg3->count, 1, 'Third page has one group remaining');