use lib qw(t/lib);
use DBICTest;
-my $schema = DBICTest::init_schema();
+my $schema = DBICTest->init_schema();
+DBICTest::Schema::CD->add_column('year2');
+$DB::single = 1;
eval { require DateTime };
plan skip_all => "Need DateTime for inflation tests" if $@;
-plan tests => 3;
+plan tests => 4;
-DBICTest::Schema::CD->inflate_column( 'year',
+$DB::single = 1;
+
+$schema->class('CD')
+#DBICTest::Schema::CD
+->inflate_column( 'year',
{ inflate => sub { DateTime->new( year => shift ) },
deflate => sub { shift->year } }
);
is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
+is( $cd->year->year, 1997, 'inflated year ok' );
+
is( $cd->year->month, 1, 'inflated month ok' );
# deflate test