72d69af6d15cfc4ca9138f1474b7bc343afccf3d
[dbsrgits/DBIx-Class.git] / t / cdbi / set_vs_DateTime.t
1 use strict;
2 use Test::More;
3 use Test::Exception;
4
5 use lib 't/cdbi/testlib';
6 use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
7
8 BEGIN {
9   eval { require DateTime; DateTime->VERSION(0.55) }
10     or plan skip_all => 'DateTime 0.55 required for this test';
11 }
12
13 {
14     package Thing;
15
16     use base 'DBIC::Test::SQLite';
17
18     Thing->columns(All  => qw[thing_id this that date]);
19 }
20
21 my $thing = Thing->construct({ thing_id => 23, date => "01-02-1994" });
22 my $date = DateTime->now;
23 lives_ok {
24   $thing->set( date => $date );
25   $thing->set( date => $date );
26 };
27
28 $thing->discard_changes;
29
30 done_testing;