File: 77join_count.t

package info (click to toggle)
libdbix-class-perl 0.082844-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (28 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest->init_schema();

cmp_ok($schema->resultset("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
                           { join => 'artist' }),
           '==', 3, 'Count by has_a ok');

cmp_ok($schema->resultset("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }),
           '==', 4, 'Count by has_many ok');

cmp_ok($schema->resultset("CD")->count(
           { 'liner_notes.notes' => { '!=' =>  undef } },
           { join => 'liner_notes' }),
           '==', 3, 'Count by might_have ok');

cmp_ok($schema->resultset("CD")->count(
           { 'year' => { '>', 1998 }, 'tags.tag' => 'Cheesy',
               'liner_notes.notes' => { 'like' => 'Buy%' } },
           { join => [ qw/tags liner_notes/ ] } ),
           '==', 2, "Mixed count ok");

done_testing;