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