Minor improvements to the maint helper scripts
[dbsrgits/DBIx-Class.git] / t / row / pkless.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
cf856357 3use strict;
4use warnings;
5
6use Test::More;
7use Test::Exception;
8
c0329273 9
cf856357 10use DBICTest;
11
12my $schema = DBICTest->init_schema();
13
14my $rs = $schema->resultset('NoPrimaryKey');
15
16my $row = $rs->create ({ foo => 1, bar => 1, baz => 1 });
17
18lives_ok (sub {
19 $row->foo (2);
20}, 'Set on pkless object works');
21
22is ($row->foo, 2, 'Column updated in-object');
23
24dies_ok (sub {
25 $row->update ({baz => 3});
26}, 'update() fails on pk-less object');
27
28is ($row->foo, 2, 'Column not updated by failed update()');
29
30dies_ok (sub {
31 $row->delete;
32}, 'delete() fails on pk-less object');
33
34done_testing;