Commit | Line | Data |
70350518 |
1 | use strict; |
8273e845 |
2 | use warnings; |
70350518 |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
a47e1233 |
8 | my $schema = DBICTest->init_schema(); |
0567538f |
9 | |
f9db5527 |
10 | my $art = $schema->resultset("Artist")->find(1); |
0567538f |
11 | |
12 | isa_ok $art => 'DBICTest::Artist'; |
13 | |
14 | my $name = 'Caterwauler McCrae'; |
15 | |
16 | ok($art->name($name) eq $name, 'update'); |
17 | |
56166f36 |
18 | { |
0567538f |
19 | my @changed_keys = $art->is_changed; |
20 | is( scalar (@changed_keys), 0, 'field changed but same value' ); |
56166f36 |
21 | } |
0567538f |
22 | |
23 | $art->discard_changes; |
24 | |
5a9e0e60 |
25 | ok($art->update({ artistid => 100 }), 'update allows pk mutation'); |
26 | |
27 | is($art->artistid, 100, 'pk mutation applied'); |
6c299e8b |
28 | |
29 | my $art_100 = $schema->resultset("Artist")->find(100); |
30 | $art_100->artistid(101); |
31 | ok($art_100->update(), 'update allows pk mutation via column accessor'); |
56166f36 |
32 | |
33 | done_testing; |