Add proper thaw hooks so schema gets re-attached
[dbsrgits/DBIx-Class.git] / t / 84serialize.t
CommitLineData
70350518 1use strict;
2use warnings;
3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
69ac22ee 7use Storable;
8
a47e1233 9my $schema = DBICTest->init_schema();
69ac22ee 10
4146e3da 11plan tests => 6;
69ac22ee 12
13my $artist = $schema->resultset('Artist')->find(1);
4146e3da 14
15{
16 my $copy = $schema->dclone($artist);
17 is_deeply($copy, $artist, "dclone row object works");
18 eval { $copy->discard_changes };
19 ok( !$@, "discard_changes okay" );
20 is($copy->id, $artist->id, "IDs still match ");
21}
22
23{
24 my $ice = $schema->freeze($artist);
25 my $copy = $schema->thaw($ice);
26 is_deeply($copy, $artist, 'dclone row object works');
27
28 eval { $copy->discard_changes };
29 ok( !$@, "discard_changes okay" );
30 is($copy->id, $artist->id, "IDs still okay");
31}
69ac22ee 32