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