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