8 my $schema = DBICTest->init_schema();
10 my $art = $schema->resultset('Artist')->find(
11 { 'me.artistid' => 1 },
12 { prefetch => 'cds', order_by => { -desc => 'cds.year' } }
16 $art->cds->search({ year => 1999 })->next->year,
18 'Found expected CD with year 1999 after refined search',
22 $art->cds->count({ year => 1999 }),
24 'Correct refined count',
27 # this still should emit no queries:
28 $schema->is_executed_querycount( sub {
34 'Correct prefetched count',
37 my @years = qw(2001 1999 1997);
38 while (my $cd = $cds->next) {
42 'Correct prefetched cd year',
46 }, 0, 'No queries on prefetched operations');