use Test::More;
use DateTime;
-plan tests => 4;
+plan tests => 7;
use lib qw(t/lib);
($cd) = DBICTest::CD->search( year => $now->year );
is( $cd->year->year, $now->year, 'deflate ok' );
+
+# re-test using alternate deflate syntax
+DBICTest::CD->has_a( 'year', 'DateTime',
+ inflate => sub { DateTime->new( year => shift ) },
+ deflate => 'year'
+);
+
+# inflation test
+$cd = DBICTest::CD->retrieve(3);
+
+is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
+
+is( $cd->year->month, 1, 'inflated month ok' );
+
+# deflate test
+$now = DateTime->now;
+$cd->year( $now );
+$cd->update;
+
+($cd) = DBICTest::CD->search( year => $now->year );
+is( $cd->year->year, $now->year, 'deflate ok' );
+