Augment shorsighted code change in 5ef76b8b
[dbsrgits/DBIx-Class.git] / t / update / ident_cond.t
diff --git a/t/update/ident_cond.t b/t/update/ident_cond.t
new file mode 100644 (file)
index 0000000..b79d56b
--- /dev/null
@@ -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;