Finally implement compound OptDep group augmentation
[dbsrgits/DBIx-Class.git] / t / cdbi / 70_implicit_inflate.t
1 use DBIx::Class::Optional::Dependencies -skip_all_without => qw( rdbms_sqlite icdt );
2
3 use strict;
4 use warnings;
5
6 # Class::DBI in its infinate wisdom allows implicit inflation
7 # and deflation of foriegn clas looups in has_a relationships.
8 # for inflate it would call ->new on the foreign_class and for
9 # deflate it would "" the column value and allow for overloading
10 # of the "" operator.
11
12 use Test::More;
13
14 use lib 't/cdbi/testlib';
15 use ImplicitInflate;
16
17 ok(ImplicitInflate->can('db_Main'), 'set_db()');
18 is(ImplicitInflate->__driver, "SQLite", 'Driver set correctly');
19
20 my $now = DateTime->now;
21
22 ImplicitInflate->create({
23   update_datetime => $now,
24   text            => "Test Data",
25 });
26
27 my $implicit_inflate = ImplicitInflate->retrieve(text => 'Test Data');
28
29 ok($implicit_inflate->update_datetime->isa('DateTime'), 'Date column inflated correctly');
30 is($implicit_inflate->update_datetime => $now, 'Date has correct year');
31
32 done_testing;