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:
30 my $orig_debug = $schema->storage->debug;
31 $schema->storage->debugcb(sub { $queries++; });
32 $schema->storage->debug(1);
38 'Correct prefetched count',
41 my @years = qw(2001 1999 1997);
42 while (my $cd = $cds->next) {
46 'Correct prefetched cd year',
50 $schema->storage->debug($orig_debug);
51 $schema->storage->debugcb(undef);
53 is ($queries, 0, 'No queries on prefetched operations');