X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frun%2F08inflate.tl;h=e21a6c6faf961a97e4d72558190bb918adbbca74;hb=e9100ff73a57d6c0e997848d38144f2901c8715e;hp=9a69380df49d46fc5dee5c3229117baf53cb006a;hpb=0567538f9dcf59ff0dcf0fe766815b242115ce20;p=dbsrgits%2FDBIx-Class.git diff --git a/t/run/08inflate.tl b/t/run/08inflate.tl index 9a69380..e21a6c6 100644 --- a/t/run/08inflate.tl +++ b/t/run/08inflate.tl @@ -1,17 +1,19 @@ sub run_tests { +my $schema = shift; eval { require DateTime }; plan skip_all => "Need DateTime for inflation tests" if $@; plan tests => 3; -DBICTest::CD->inflate_column( 'year', +DBICTest::Schema::CD->inflate_column( 'year', { inflate => sub { DateTime->new( year => shift ) }, deflate => sub { shift->year } } ); +Class::C3->reinitialize; # inflation test -my $cd = DBICTest::CD->find(3); +my $cd = $schema->resultset("CD")->find(3); is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' ); @@ -22,7 +24,7 @@ my $now = DateTime->now; $cd->year( $now ); $cd->update; -($cd) = DBICTest::CD->search( year => $now->year ); +($cd) = $schema->resultset("CD")->search( year => $now->year ); is( $cd->year->year, $now->year, 'deflate ok' ); }