DBIx::Class::Bundled
[dbsrgits/DBIx-Class.git] / t / dq / where.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6 use Test::Warn;
7 use lib qw(t/lib);
8 use DBICTest;
9 use Data::Query::ExprDeclare;
10 use DBIC::SqlMakerTest;
11
12 my $schema = DBICTest->init_schema();
13
14 $schema->source($_)->resultset_class('DBIx::Class::ResultSet::WithDQMethods')
15   for qw(CD Tag);
16
17 my $cds = $schema->resultset('CD')
18                  ->where(expr { $_->artist->name eq 'Caterwauler McCrae' });
19
20 is($cds->count, 3, 'CDs via join injection');
21
22 my $tags = $schema->resultset('Tag')
23                   ->where(expr { $_->cd->artist->name eq 'Caterwauler McCrae' });
24
25 is($tags->count, 5, 'Tags via two step join injection');
26
27 done_testing;