File: 84serialize.t

package info (click to toggle)
libdbix-class-perl 0.08010-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,052 kB
  • ctags: 1,064
  • sloc: perl: 10,536; sql: 225; makefile: 45
file content (32 lines) | stat: -rwxr-xr-x 679 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use strict;
use warnings;  

use Test::More;
use lib qw(t/lib);
use DBICTest;
use Storable;

my $schema = DBICTest->init_schema();

plan tests => 6;

my $artist = $schema->resultset('Artist')->find(1);

{
  my $copy = $schema->dclone($artist);
  is_deeply($copy, $artist, "dclone row object works");
  eval { $copy->discard_changes };
  ok( !$@, "discard_changes okay" );
  is($copy->id, $artist->id, "IDs still match ");
}

{
  my $ice = $schema->freeze($artist);
  my $copy = $schema->thaw($ice);
  is_deeply($copy, $artist, 'dclone row object works');

  eval { $copy->discard_changes };
  ok( !$@, "discard_changes okay" );
  is($copy->id, $artist->id, "IDs still okay");
}