3 eval { require DateTime };
4 plan skip_all => "Need DateTime for inflation tests" if $@;
8 DBICTest::CD->inflate_column( 'year',
9 { inflate => sub { DateTime->new( year => shift ) },
10 deflate => sub { shift->year } }
14 my $cd = DBICTest::CD->find(3);
16 is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
18 is( $cd->year->month, 1, 'inflated month ok' );
21 my $now = DateTime->now;
25 ($cd) = DBICTest::CD->search( year => $now->year );
26 is( $cd->year->year, $now->year, 'deflate ok' );