10 my $schema = DBICTest->init_schema();
12 my $cds = $schema->resultset("CD")->search({ cdid => 1 }, { join => { cd_to_producer => 'producer' } });
13 cmp_ok($cds->count, '>', 1, "extra joins explode entity count");
16 [ 'prefetch-collapsed has_many' => { prefetch => 'cd_to_producer' } ],
17 [ 'distict-collapsed result' => { distinct => 1 } ],
18 [ 'explicit collapse request' => { collapse => 1 } ],
21 my $diag = $arg->[0] . ($hri ? ' with HRI' : '');
23 my $rs = $cds->search({}, {
25 $hri ? ( result_class => 'DBIx::Class::ResultClass::HashRefInflator' ) : (),
31 "Count correct on $diag",
37 "Amount of constructed objects matches count on $diag",
42 # JOIN and LEFT JOIN issues mean that we've seen problems where counted rows and fetched rows are sometimes 1 higher than they should
43 # be in the related resultset.
44 my $artist=$schema->resultset('Artist')->create({name => 'xxx'});
45 is($artist->related_resultset('cds')->count(), 0, "No CDs found for a shiny new artist");
46 is(scalar($artist->related_resultset('cds')->all()), 0, "No CDs fetched for a shiny new artist");
48 my $artist_rs = $schema->resultset('Artist')->search({artistid => $artist->id});
49 is($artist_rs->related_resultset('cds')->count(), 0, "No CDs counted for a shiny new artist using a resultset search");
50 is(scalar($artist_rs->related_resultset('cds')->all), 0, "No CDs fetched for a shiny new artist using a resultset search");