85f48d083d30cf3eb7f159259713ecdd2f4cfd38
[dbsrgits/DBIx-Class.git] / t / count / in_subquery.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 use lib qw(t/lib);
7 use DBICTest;
8
9 my $schema = DBICTest->init_schema();
10
11 {
12     my $rs = $schema->resultset("CD")->search(
13         { 'artist.name' => 'Caterwauler McCrae' },
14         { join => [qw/artist/]}
15     );
16     my $squery = $rs->get_column('cdid')->as_query;
17     my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $squery } } );
18     is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');
19 }
20
21 done_testing;