Commit | Line | Data |
0567538f |
1 | sub run_tests { |
1edaf6fe |
2 | my $schema = shift; |
0567538f |
3 | |
4 | eval "use DBD::SQLite"; |
5 | plan skip_all => 'needs DBD::SQLite for testing' if $@; |
6 | plan tests => 4; |
7 | |
f9db5527 |
8 | cmp_ok($schema->resultset("CD")->count({ 'artist.name' => 'Caterwauler McCrae' }, |
0567538f |
9 | { join => 'artist' }), |
10 | '==', 3, 'Count by has_a ok'); |
11 | |
f9db5527 |
12 | cmp_ok($schema->resultset("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }), |
0567538f |
13 | '==', 4, 'Count by has_many ok'); |
14 | |
f9db5527 |
15 | cmp_ok($schema->resultset("CD")->count( |
0567538f |
16 | { 'liner_notes.notes' => { '!=' => undef } }, |
17 | { join => 'liner_notes' }), |
18 | '==', 3, 'Count by might_have ok'); |
19 | |
f9db5527 |
20 | cmp_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 | |
28 | 1; |