Commit | Line | Data |
c0329273 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
2 | |
70350518 |
3 | use strict; |
68de9438 |
4 | use warnings; |
70350518 |
5 | |
6 | use Test::More; |
c0329273 |
7 | |
70350518 |
8 | use DBICTest; |
9 | |
a47e1233 |
10 | my $schema = DBICTest->init_schema(); |
0567538f |
11 | |
f9db5527 |
12 | cmp_ok($schema->resultset("CD")->count({ 'artist.name' => 'Caterwauler McCrae' }, |
0567538f |
13 | { join => 'artist' }), |
14 | '==', 3, 'Count by has_a ok'); |
15 | |
f9db5527 |
16 | cmp_ok($schema->resultset("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }), |
0567538f |
17 | '==', 4, 'Count by has_many ok'); |
18 | |
f9db5527 |
19 | cmp_ok($schema->resultset("CD")->count( |
0567538f |
20 | { 'liner_notes.notes' => { '!=' => undef } }, |
21 | { join => 'liner_notes' }), |
22 | '==', 3, 'Count by might_have ok'); |
23 | |
f9db5527 |
24 | cmp_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 |
30 | done_testing; |