Move a number of tests to xt, restructure extra lists
[dbsrgits/DBIx-Class.git] / xt / extra / diagnostics / malformed_rel_declaration.t
CommitLineData
6909ab3c 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Exception;
6use lib qw(t/lib);
7use DBICTest::Schema::Artist;
8
9my $pkg = 'DBICTest::Schema::Artist';
10
11for my $call (qw(has_many might_have has_one belongs_to)) {
12 {
13 local $TODO = 'stupid stupid heuristic - needs to die'
14 if $call eq 'belongs_to';
15
16 throws_ok {
17 $pkg->$call( foos => 'nonexistent bars', { foo => 'self.artistid' } );
18 } qr/Malformed relationship condition key 'foo': must be prefixed with 'foreign.'/,
19 "Correct exception on $call with malformed foreign.";
20 }
21
22 throws_ok {
23 $pkg->has_many( foos => 'nonexistent bars', { 'foreign.foo' => 'name' } );
24 } qr/\QMalformed relationship condition value 'name': must be prefixed with 'self.'/,
25 "Correct exception on $call with malformed self.";
26}
27
28done_testing;