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