In d009cb7d I stupidly created a "double around()"
[dbsrgits/DBIx-Class.git] / t / 77join_count.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
70350518 3use strict;
68de9438 4use warnings;
70350518 5
6use Test::More;
c0329273 7
70350518 8use DBICTest;
9
a47e1233 10my $schema = DBICTest->init_schema();
0567538f 11
f9db5527 12cmp_ok($schema->resultset("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
0567538f 13 { join => 'artist' }),
14 '==', 3, 'Count by has_a ok');
15
f9db5527 16cmp_ok($schema->resultset("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }),
0567538f 17 '==', 4, 'Count by has_many ok');
18
f9db5527 19cmp_ok($schema->resultset("CD")->count(
0567538f 20 { 'liner_notes.notes' => { '!=' => undef } },
21 { join => 'liner_notes' }),
22 '==', 3, 'Count by might_have ok');
23
f9db5527 24cmp_ok($schema->resultset("CD")->count(
0567538f 25 { 'year' => { '>', 1998 }, 'tags.tag' => 'Cheesy',
26 'liner_notes.notes' => { 'like' => 'Buy%' } },
27 { join => [ qw/tags liner_notes/ ] } ),
28 '==', 2, "Mixed count ok");
29
68de9438 30done_testing;