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