1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
9 my $schema = DBICTest->init_schema();
11 my $cds = $schema->resultset("CD")->search({ cdid => 1 }, { join => { cd_to_producer => 'producer' } });
12 cmp_ok($cds->count, '>', 1, "extra joins explode entity count");
15 [ 'prefetch-collapsed has_many' => { prefetch => 'cd_to_producer' } ],
16 [ 'distict-collapsed result' => { distinct => 1 } ],
17 [ 'explicit collapse request' => { collapse => 1 } ],
20 my $diag = $arg->[0] . ($hri ? ' with HRI' : '');
22 my $rs = $cds->search({}, {
24 $hri ? ( result_class => 'DBIx::Class::ResultClass::HashRefInflator' ) : (),
30 "Count correct on $diag",
36 "Amount of constructed objects matches count on $diag",
41 # JOIN and LEFT JOIN issues mean that we've seen problems where counted rows and fetched rows are sometimes 1 higher than they should
42 # be in the related resultset.
43 my $artist=$schema->resultset('Artist')->create({name => 'xxx'});
44 is($artist->related_resultset('cds')->count(), 0, "No CDs found for a shiny new artist");
45 is(scalar($artist->related_resultset('cds')->all()), 0, "No CDs fetched for a shiny new artist");
47 my $artist_rs = $schema->resultset('Artist')->search({artistid => $artist->id});
48 is($artist_rs->related_resultset('cds')->count(), 0, "No CDs counted for a shiny new artist using a resultset search");
49 is(scalar($artist_rs->related_resultset('cds')->all), 0, "No CDs fetched for a shiny new artist using a resultset search");