Commit | Line | Data |
c0329273 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
2 | |
6909ab3c |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | use Test::Exception; |
c0329273 |
8 | |
6909ab3c |
9 | use DBICTest::Schema::Artist; |
10 | |
11 | my $pkg = 'DBICTest::Schema::Artist'; |
12 | |
13 | for my $call (qw(has_many might_have has_one belongs_to)) { |
14 | { |
15 | local $TODO = 'stupid stupid heuristic - needs to die' |
16 | if $call eq 'belongs_to'; |
17 | |
18 | throws_ok { |
19 | $pkg->$call( foos => 'nonexistent bars', { foo => 'self.artistid' } ); |
20 | } qr/Malformed relationship condition key 'foo': must be prefixed with 'foreign.'/, |
21 | "Correct exception on $call with malformed foreign."; |
22 | } |
23 | |
24 | throws_ok { |
25 | $pkg->has_many( foos => 'nonexistent bars', { 'foreign.foo' => 'name' } ); |
26 | } qr/\QMalformed relationship condition value 'name': must be prefixed with 'self.'/, |
27 | "Correct exception on $call with malformed self."; |
28 | } |
29 | |
30 | done_testing; |