added some notes in the tests and fixed get_from_storage to actually use the new...
[dbsrgits/DBIx-Class.git] / t / 68inflate.t
index 9cbaab9..3aa428d 100644 (file)
@@ -5,15 +5,16 @@ use Test::More;
 use lib qw(t/lib);
 use DBICTest;
 
-DBICTest::Schema::CD->add_column('year');
 my $schema = DBICTest->init_schema();
 
 eval { require DateTime };
 plan skip_all => "Need DateTime for inflation tests" if $@;
 
-plan tests => 22;
+plan tests => 21;
 
-DBICTest::Schema::CD->inflate_column( 'year',
+$schema->class('CD')
+#DBICTest::Schema::CD
+->inflate_column( 'year',
     { inflate => sub { DateTime->new( year => shift ) },
       deflate => sub { shift->year } }
 );
@@ -90,12 +91,6 @@ ok(!$@, 'update using scalarref ok');
 $cd = $schema->resultset("CD")->find(3);                 
 is($cd->year->year, $before_year + 1, 'deflate ok');
 
-my $upd = { 'year' => $now->truncate(to => 'month'), title => 'An Updated Title' };
-my $upd_copy = { %$upd };
-eval { $cd->update($upd) };
-ok(!$@, 'update worked okay');
-ok(exists $upd->{year} && $upd->{year} == $upd_copy->{year}, "update doesn't change passed hashref");
-
 # discard_changes test
 $cd = $schema->resultset("CD")->find(3);                 
 # inflate the year
@@ -104,6 +99,10 @@ $cd->update({ year => \'year + 1'});
 $cd->discard_changes;
 
 is($cd->year->year, $before_year + 1, 'discard_changes clears the inflated value');
+
+my $copy = $cd->copy({ year => $now, title => "zemoose" });
+
+isnt( $copy->year->year, $before_year, "copy" );
  
 # eval { $cd->store_inflated_column('year', \'year + 1') };
 # print STDERR "ERROR: $@" if($@);