Yeah, committing the new tests would help ...
[dbsrgits/DBIx-Class.git] / t / run / 08inflate.tl
CommitLineData
0567538f 1sub run_tests {
2
3eval { require DateTime };
4plan skip_all => "Need DateTime for inflation tests" if $@;
5
6plan tests => 3;
7
8DBICTest::CD->inflate_column( 'year',
9 { inflate => sub { DateTime->new( year => shift ) },
10 deflate => sub { shift->year } }
11);
12
13# inflation test
14my $cd = DBICTest::CD->find(3);
15
16is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
17
18is( $cd->year->month, 1, 'inflated month ok' );
19
20# deflate test
21my $now = DateTime->now;
22$cd->year( $now );
23$cd->update;
24
25($cd) = DBICTest::CD->search( year => $now->year );
26is( $cd->year->year, $now->year, 'deflate ok' );
27
28}
29
301;