Streamline (logic-wise, not syntax-wise) handling of 'foreign_values'
[dbsrgits/DBIx-Class-Historic.git] / t / relationship / resolve_relationship_condition.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6
7 use lib 't/lib';
8 use DBICTest;
9
10 my $schema = DBICTest->init_schema();
11
12 for (
13   { year => [1,2] },
14   { year => ['-and',1,2] },
15   { -or => [ year => 1, year => 2 ] },
16   { -and => [ year => 1, year => 2 ] },
17 ) {
18   throws_ok {
19     $schema->source('Track')->_resolve_relationship_condition(
20       rel_name => 'cd_cref_cond',
21       self_alias => 'me',
22       foreign_alias => 'cd',
23       foreign_values => $_
24     );
25   } qr/
26     \Qis not a column on related source 'CD'\E
27       |
28     \QValue supplied for '...{foreign_values}{year}' is not a direct equivalence expression\E
29   /x;
30 }
31
32 done_testing;