File: malformed_declaration.t

package info (click to toggle)
libdbix-class-perl 0.082843-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (28 lines) | stat: -rw-r--r-- 804 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;

use Test::More;
use Test::Exception;
use lib qw(t/lib);
use DBICTest::Schema::Artist;

my $pkg = 'DBICTest::Schema::Artist';

for my $call (qw(has_many might_have has_one belongs_to)) {
  {
    local $TODO = 'stupid stupid heuristic - needs to die'
      if $call eq 'belongs_to';

    throws_ok {
      $pkg->$call( foos => 'nonexistent bars', { foo => 'self.artistid' } );
    } qr/Malformed relationship condition key 'foo': must be prefixed with 'foreign.'/,
    "Correct exception on $call with malformed foreign.";
  }

  throws_ok {
    $pkg->has_many( foos => 'nonexistent bars', { 'foreign.foo' => 'name' } );
  } qr/\QMalformed relationship condition value 'name': must be prefixed with 'self.'/,
  "Correct exception on $call with malformed self.";
}

done_testing;