d7d4cf00fd2e62aaf666d4ff56a88c8e76761563
[dbsrgits/DBIx-Class.git] / t / update / ident_cond.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use lib qw(t/lib);
6 use DBICTest;
7
8 my $schema = DBICTest->init_schema();
9
10 my $artist = $schema->resultset('Artist')->find(1);
11
12 is_deeply(
13   [ $artist->id, $artist->ident_condition, $artist->_storage_ident_condition ],
14   [ 1, { artistid => 1 }, { artistid => 1 } ],
15   'Correct identity state of freshly retrieved object',
16 );
17
18 $artist->artistid(888);
19
20 is_deeply(
21   [ $artist->id, $artist->ident_condition, $artist->_storage_ident_condition ],
22   [ 888, { artistid => 888 }, { artistid => 1 } ],
23   'Correct identity state of object with modified PK',
24 );
25
26 $artist->update;
27
28 is_deeply(
29   [ $artist->id, $artist->ident_condition, $artist->_storage_ident_condition ],
30   [ 888, { artistid => 888 }, { artistid => 888 } ],
31   'Correct identity state after storage update',
32 );
33
34 done_testing;