Harden t/54taint.t against possible future changes in -T
[dbsrgits/DBIx-Class.git] / t / resultsource / set_primary_key.t
CommitLineData
8228ee62 1use strict;
2use warnings;
3use Test::More;
4use Test::Exception;
5use Test::Warn;
6
7use lib 't/lib';
8use DBICTest;
9
10throws_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
18warnings_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/,
b611e6d7 28'proper exception on is_nullable column as PK';
8228ee62 29
30done_testing;