Make joined rs counts backwards compatible - we do not collapse a result exploded...
[dbsrgits/DBIx-Class.git] / t / count / joined.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 use lib qw(t/lib);
7
8 use DBICTest;
9
10 plan tests => 3;
11
12 my $schema = DBICTest->init_schema();
13
14 my $cds = $schema->resultset("CD")->search({ cdid => 1 }, { join => { cd_to_producer => 'producer' } });
15 cmp_ok($cds->count, '>', 1, "extra joins explode entity count");
16
17 is (
18   $cds->search({}, { prefetch => 'cd_to_producer' })->count,
19   1,
20   "Count correct with extra joins collapsed by prefetch"
21 );
22
23 is (
24   $cds->search({}, { distinct => 1 })->count,
25   1,
26   "Count correct with requested distinct collapse of main table"
27 );
28
29
30
31