Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / t / 69update.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
70350518 3use strict;
8273e845 4use warnings;
70350518 5
6use Test::More;
c0329273 7
70350518 8use DBICTest;
9
a47e1233 10my $schema = DBICTest->init_schema();
0567538f 11
f9db5527 12my $art = $schema->resultset("Artist")->find(1);
0567538f 13
14isa_ok $art => 'DBICTest::Artist';
15
16my $name = 'Caterwauler McCrae';
17
18ok($art->name($name) eq $name, 'update');
19
56166f36 20{
0567538f 21 my @changed_keys = $art->is_changed;
22 is( scalar (@changed_keys), 0, 'field changed but same value' );
56166f36 23}
0567538f 24
25$art->discard_changes;
26
5a9e0e60 27ok($art->update({ artistid => 100 }), 'update allows pk mutation');
28
29is($art->artistid, 100, 'pk mutation applied');
6c299e8b 30
31my $art_100 = $schema->resultset("Artist")->find(100);
32$art_100->artistid(101);
33ok($art_100->update(), 'update allows pk mutation via column accessor');
56166f36 34
35done_testing;