8 my $schema = DBICTest->init_schema();
10 DBICTest::Schema::CD->add_column('year2');
12 eval { require DateTime };
13 plan skip_all => "Need DateTime for inflation tests" if $@;
21 ->inflate_column( 'year',
22 { inflate => sub { DateTime->new( year => shift ) },
23 deflate => sub { shift->year } }
25 Class::C3->reinitialize;
28 my $cd = $schema->resultset("CD")->find(3);
30 is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
32 is( $cd->year->year, 1997, 'inflated year ok' );
34 is( $cd->year->month, 1, 'inflated month ok' );
37 my $now = DateTime->now;
41 ($cd) = $schema->resultset("CD")->search( year => $now->year );
42 is( $cd->year->year, $now->year, 'deflate ok' );