Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / resultsource / set_primary_key.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
8228ee62 3use strict;
4use warnings;
5use Test::More;
6use Test::Exception;
7use Test::Warn;
8
c0329273 9
8228ee62 10use DBICTest;
11
12throws_ok {
13 package Foo;
14 use base 'DBIx::Class::Core';
15 __PACKAGE__->table('foo');
16 __PACKAGE__->set_primary_key('bar')
17} qr/No such column 'bar' on source 'foo' /,
18'proper exception on non-existing column as PK';
19
20warnings_exist {
21 package Foo2;
22 use base 'DBIx::Class::Core';
23 __PACKAGE__->table('foo');
24 __PACKAGE__->add_columns(
25 foo => {},
26 bar => { is_nullable => 1 },
27 );
28 __PACKAGE__->set_primary_key(qw(foo bar))
29} qr/Primary key of source 'foo' includes the column 'bar' which has its 'is_nullable' attribute set to true/,
b611e6d7 30'proper exception on is_nullable column as PK';
8228ee62 31
32done_testing;