1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
11 my $schema = DBICTest->init_schema();
14 $schema->populate ('Artist', [
20 # add 3 extra cds to every artist
21 for my $ar ($schema->resultset ('Artist')->all) {
22 for my $cdnum (1 .. 3) {
23 $ar->create_related ('cds', {
24 title => "bogon $cdnum",
25 year => 2000 + $cdnum,
30 my $cds = $schema->resultset ('CD')->search ({}, { group_by => 'artist' } );
31 is ($cds->count, 5, 'Resultset collapses to 5 groups');
33 my ($pg1, $pg2, $pg3) = map { $cds->search_rs ({}, {rows => 2, page => $_}) } (1..3);
35 for ($pg1, $pg2, $pg3) {
36 is ($_->pager->total_entries, 5, 'Total count via pager correct');
39 is ($pg1->count, 2, 'First page has 2 groups');
40 is ($pg2->count, 2, 'Second page has 2 groups');
41 is ($pg3->count, 1, 'Third page has one group remaining');