Commit | Line | Data |
8228ee62 |
1 | use strict; |
2 | use warnings; |
3 | use Test::More; |
4 | use Test::Exception; |
5 | use Test::Warn; |
6 | |
7 | use lib 't/lib'; |
8 | use DBICTest; |
9 | |
10 | throws_ok { |
11 | package Foo; |
12 | use base 'DBIx::Class::Core'; |
13 | __PACKAGE__->table('foo'); |
14 | __PACKAGE__->set_primary_key('bar') |
15 | } qr/No such column 'bar' on source 'foo' /, |
16 | 'proper exception on non-existing column as PK'; |
17 | |
18 | warnings_exist { |
19 | package Foo2; |
20 | use base 'DBIx::Class::Core'; |
21 | __PACKAGE__->table('foo'); |
22 | __PACKAGE__->add_columns( |
23 | foo => {}, |
24 | bar => { is_nullable => 1 }, |
25 | ); |
26 | __PACKAGE__->set_primary_key(qw(foo bar)) |
27 | } qr/Primary key of source 'foo' includes the column 'bar' which has its 'is_nullable' attribute set to true/, |
0b56089d |
28 | 'proper exception on is_nullable column as PK'; |
8228ee62 |
29 | |
30 | done_testing; |