Commit | Line | Data |
2040ad73 |
1 | use strict; |
2 | use 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 | |
10 | use Test::More; |
11 | use DBIx::Class::Optional::Dependencies; |
12 | |
13 | BEGIN { |
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 | |
18 | use lib 't/cdbi/testlib'; |
19 | use ImplicitInflate; |
20 | |
21 | ok(ImplicitInflate->can('db_Main'), 'set_db()'); |
22 | is(ImplicitInflate->__driver, "SQLite", 'Driver set correctly'); |
23 | |
24 | my $now = DateTime->now; |
25 | |
26 | ImplicitInflate->create({ |
27 | update_datetime => $now, |
28 | text => "Test Data", |
29 | }); |
30 | |
31 | my $implicit_inflate = ImplicitInflate->retrieve(text => 'Test Data'); |
32 | |
33 | ok($implicit_inflate->update_datetime->isa('DateTime'), 'Date column inflated correctly'); |
34 | is($implicit_inflate->update_datetime => $now, 'Date has correct year'); |
35 | |
36 | done_testing; |