Add import-time action stub to OptDeps, switch distbuild checks to it
[dbsrgits/DBIx-Class.git] / t / cdbi / 70_implicit_inflate.t
CommitLineData
2040ad73 1use strict;
2use warnings;
3
4# Class::DBI in its infinate wisdom allows implicit inflation
5# and deflation of foriegn clas looups in has_a relationships.
6# for inflate it would call ->new on the foreign_class and for
7# deflate it would "" the column value and allow for overloading
8# of the "" operator.
9
10use Test::More;
11use DBIx::Class::Optional::Dependencies;
12
13BEGIN {
14 plan skip_all => "Test needs ".DBIx::Class::Optional::Dependencies->req_missing_for('test_dt_sqlite')
15 unless DBIx::Class::Optional::Dependencies->req_ok_for('test_dt_sqlite');
16}
17
18use lib 't/cdbi/testlib';
19use ImplicitInflate;
20
21ok(ImplicitInflate->can('db_Main'), 'set_db()');
22is(ImplicitInflate->__driver, "SQLite", 'Driver set correctly');
23
24my $now = DateTime->now;
25
26ImplicitInflate->create({
27 update_datetime => $now,
28 text => "Test Data",
29});
30
31my $implicit_inflate = ImplicitInflate->retrieve(text => 'Test Data');
32
33ok($implicit_inflate->update_datetime->isa('DateTime'), 'Date column inflated correctly');
34is($implicit_inflate->update_datetime => $now, 'Date has correct year');
35
36done_testing;