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