10328e23d85d6fb172d0c6b8b1c51299f791e5b7
[dbsrgits/DBIx-Class.git] / xt / extra / diagnostics / find_via_unsupported_rel.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9 use DBICTest;
10
11 my $schema = DBICTest->init_schema( no_deploy => 1 );
12
13 my $artist = $schema->resultset('Artist')->new_result({ artistid => 1 });
14
15 throws_ok {
16   $schema->resultset('ArtistUndirectedMap')->find({
17     mapped_artists => $artist,
18   });
19 } qr/\QUnable to complete value inferrence - relationship 'mapped_artists' on source 'ArtistUndirectedMap' results in expression(s) instead of definitive values: ( id1 = ? OR id2 = ? )/,
20   'proper exception on OR relationship inferrence'
21 ;
22
23 throws_ok {
24   $schema->resultset('Artwork_to_Artist')->find({
25     artist_limited_rank_opaque => $artist
26   })
27 } qr/\QRelationship 'artist_limited_rank_opaque' on source 'Artwork_to_Artist' does not resolve to a 'foreign_values'-based reversed-join-free condition fragment/,
28   'proper exception on ipaque custom cond'
29 ;
30
31 done_testing;