X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fupdate%2Fident_cond.t;fp=t%2Fupdate%2Fident_cond.t;h=b79d56bda95da7df78dd3ba19e707d599e0d1e1e;hb=fe0708a2d68b5d34b6bc6f7e70164c3e569f1dd0;hp=0000000000000000000000000000000000000000;hpb=01272eb81fe3a43e0a2f7befa465cc669945d543;p=dbsrgits%2FDBIx-Class.git diff --git a/t/update/ident_cond.t b/t/update/ident_cond.t new file mode 100644 index 0000000..b79d56b --- /dev/null +++ b/t/update/ident_cond.t @@ -0,0 +1,34 @@ +use strict; +use warnings; + +use Test::More; +use lib qw(t/lib); +use DBICTest; + +my $schema = DBICTest->init_schema(); + +my $artist = $schema->resultset('Artist')->next; + +is_deeply( + [ $artist->id, $artist->ident_condition, $artist->_storage_ident_condition ], + [ 1, { artistid => 1 }, { artistid => 1 } ], + 'Correct identity state of freshly retrieved object', +); + +$artist->artistid(888); + +is_deeply( + [ $artist->id, $artist->ident_condition, $artist->_storage_ident_condition ], + [ 888, { artistid => 888 }, { artistid => 1 } ], + 'Correct identity state of object with modified PK', +); + +$artist->update; + +is_deeply( + [ $artist->id, $artist->ident_condition, $artist->_storage_ident_condition ], + [ 888, { artistid => 888 }, { artistid => 888 } ], + 'Correct identity state after storage update', +); + +done_testing;