Commit | Line | Data |
51516b1c |
1 | use Test::More; |
cabca325 |
2 | use DateTime; |
51516b1c |
3 | |
4 | plan tests => 4; |
5 | |
6 | use lib qw(t/lib); |
7 | |
8 | use_ok('DBICTest'); |
9 | |
10 | # inflation test |
11 | my $cd = DBICTest::CD->retrieve(3); |
12 | is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' ); |
13 | |
14 | is( $cd->year->month, 1, 'inflated month ok' ); |
15 | |
16 | # deflate test |
cabca325 |
17 | my $now = DateTime->now; |
18 | $cd->year( $now ); |
51516b1c |
19 | $cd->update; |
20 | |
cabca325 |
21 | ($cd) = DBICTest::CD->search( year => $now->year ); |
22 | is( $cd->year, $now->year, 'deflate ok' ); |