Switched tests to use DBICTest->class("...")
[dbsrgits/DBIx-Class.git] / t / run / 17join_count.tl
CommitLineData
0567538f 1sub run_tests {
2
3eval "use DBD::SQLite";
4plan skip_all => 'needs DBD::SQLite for testing' if $@;
5plan tests => 4;
6
3712e4f4 7cmp_ok(DBICTest->class("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
0567538f 8 { join => 'artist' }),
9 '==', 3, 'Count by has_a ok');
10
3712e4f4 11cmp_ok(DBICTest->class("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }),
0567538f 12 '==', 4, 'Count by has_many ok');
13
3712e4f4 14cmp_ok(DBICTest->class("CD")->count(
0567538f 15 { 'liner_notes.notes' => { '!=' => undef } },
16 { join => 'liner_notes' }),
17 '==', 3, 'Count by might_have ok');
18
3712e4f4 19cmp_ok(DBICTest->class("CD")->count(
0567538f 20 { 'year' => { '>', 1998 }, 'tags.tag' => 'Cheesy',
21 'liner_notes.notes' => { 'like' => 'Buy%' } },
22 { join => [ qw/tags liner_notes/ ] } ),
23 '==', 2, "Mixed count ok");
24
25}
26
271;