Neither of these can fail now that we dep on 5.8.1 (missed in 55087b99)
[dbsrgits/DBIx-Class.git] / t / 77join_count.t
CommitLineData
70350518 1use strict;
68de9438 2use warnings;
70350518 3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7
a47e1233 8my $schema = DBICTest->init_schema();
0567538f 9
f9db5527 10cmp_ok($schema->resultset("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
0567538f 11 { join => 'artist' }),
12 '==', 3, 'Count by has_a ok');
13
f9db5527 14cmp_ok($schema->resultset("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }),
0567538f 15 '==', 4, 'Count by has_many ok');
16
f9db5527 17cmp_ok($schema->resultset("CD")->count(
0567538f 18 { 'liner_notes.notes' => { '!=' => undef } },
19 { join => 'liner_notes' }),
20 '==', 3, 'Count by might_have ok');
21
f9db5527 22cmp_ok($schema->resultset("CD")->count(
0567538f 23 { 'year' => { '>', 1998 }, 'tags.tag' => 'Cheesy',
24 'liner_notes.notes' => { 'like' => 'Buy%' } },
25 { join => [ qw/tags liner_notes/ ] } ),
26 '==', 2, "Mixed count ok");
27
68de9438 28done_testing;