8 DBICTest::Schema::CD->add_column('year');
9 my $schema = DBICTest->init_schema();
11 eval { require DateTime };
12 plan skip_all => "Need DateTime for inflation tests" if $@;
16 DBICTest::Schema::CD->inflate_column( 'year',
17 { inflate => sub { DateTime->new( year => shift ) },
18 deflate => sub { shift->year } }
20 Class::C3->reinitialize;
23 my $cd = $schema->resultset("CD")->find(3);
25 is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
27 is( $cd->year->month, 1, 'inflated month ok' );
30 my $now = DateTime->now;
34 ($cd) = $schema->resultset("CD")->search( year => $now->year );
35 is( $cd->year->year, $now->year, 'deflate ok' );