Merge the relationship resolution rework
[dbsrgits/DBIx-Class.git] / t / cdbi / 70_implicit_inflate.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
54a9a088 2use DBIx::Class::Optional::Dependencies -skip_all_without => qw( cdbicompat rdbms_sqlite ic_dt );
cb551b07 3
2040ad73 4use strict;
5use 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
13use Test::More;
2040ad73 14
15use lib 't/cdbi/testlib';
16use ImplicitInflate;
17
18ok(ImplicitInflate->can('db_Main'), 'set_db()');
19is(ImplicitInflate->__driver, "SQLite", 'Driver set correctly');
20
21my $now = DateTime->now;
22
23ImplicitInflate->create({
24 update_datetime => $now,
25 text => "Test Data",
26});
27
28my $implicit_inflate = ImplicitInflate->retrieve(text => 'Test Data');
29
30ok($implicit_inflate->update_datetime->isa('DateTime'), 'Date column inflated correctly');
31is($implicit_inflate->update_datetime => $now, 'Date has correct year');
32
33done_testing;