Commit | Line | Data |
8a3a5bc5 |
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); |
70a55c69 |
8 | use Data::Query::ExprDeclare; |
8a3a5bc5 |
9 | use DBICTest; |
10 | use DBIC::SqlMakerTest; |
8a3a5bc5 |
11 | |
12 | my $schema = DBICTest->init_schema(); |
13 | |
70a55c69 |
14 | $schema->source($_)->resultset_class('DBIx::Class::ResultSet::WithDQMethods') |
15 | for qw(CD Tag); |
8a3a5bc5 |
16 | |
70a55c69 |
17 | my $cds = $schema->resultset('CD') |
18 | ->where(expr { $_->artist->name eq 'Caterwauler McCrae' }); |
8a3a5bc5 |
19 | |
70a55c69 |
20 | is($cds->count, 3, 'CDs via join injection'); |
8a3a5bc5 |
21 | |
70a55c69 |
22 | my $tags = $schema->resultset('Tag') |
23 | ->where(expr { $_->cd->artist->name eq 'Caterwauler McCrae' }); |
8a3a5bc5 |
24 | |
70a55c69 |
25 | is($tags->count, 5, 'Tags via two step join injection'); |
8a3a5bc5 |
26 | |
27 | done_testing; |