Fix identity fiasco
[dbsrgits/DBIx-Class.git] / t / row / pkless.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6
7 use lib qw(t/lib);
8 use DBICTest;
9
10 my $schema = DBICTest->init_schema();
11
12 my $rs = $schema->resultset('NoPrimaryKey');
13
14 my $row = $rs->create ({ foo => 1, bar => 1, baz => 1 });
15
16 lives_ok (sub {
17   $row->foo (2);
18 }, 'Set on pkless object works');
19
20 is ($row->foo, 2, 'Column updated in-object');
21
22 dies_ok (sub {
23   $row->update ({baz => 3});
24 }, 'update() fails on pk-less object');
25
26 is ($row->foo, 2, 'Column not updated by failed update()');
27
28 dies_ok (sub {
29   $row->delete;
30 }, 'delete() fails on pk-less object');
31
32 done_testing;