Removed BasicRels and reorganized where the various init/setup code resides.
[dbsrgits/DBIx-Class.git] / t / run / 17join_count.tl
CommitLineData
0567538f 1sub run_tests {
1edaf6fe 2my $schema = shift;
0567538f 3
4eval "use DBD::SQLite";
5plan skip_all => 'needs DBD::SQLite for testing' if $@;
6plan tests => 4;
7
f9db5527 8cmp_ok($schema->resultset("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
0567538f 9 { join => 'artist' }),
10 '==', 3, 'Count by has_a ok');
11
f9db5527 12cmp_ok($schema->resultset("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }),
0567538f 13 '==', 4, 'Count by has_many ok');
14
f9db5527 15cmp_ok($schema->resultset("CD")->count(
0567538f 16 { 'liner_notes.notes' => { '!=' => undef } },
17 { join => 'liner_notes' }),
18 '==', 3, 'Count by might_have ok');
19
f9db5527 20cmp_ok($schema->resultset("CD")->count(
0567538f 21 { 'year' => { '>', 1998 }, 'tags.tag' => 'Cheesy',
22 'liner_notes.notes' => { 'like' => 'Buy%' } },
23 { join => [ qw/tags liner_notes/ ] } ),
24 '==', 2, "Mixed count ok");
25
26}
27
281;