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