Test that DateTime objects can safely be updated twice (which is what triggers
[dbsrgits/DBIx-Class.git] / t / cdbi-t / set_vs_DateTime.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Test::More;
5 use Test::Exception;
6
7 BEGIN {
8   eval "use DBIx::Class::CDBICompat;";
9   plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
10     if $@;
11   plan skip_all => "DateTime required" unless eval { require DateTime };
12   plan tests => 1;
13 }
14
15 {
16     package Thing;
17
18     use base 'DBIx::Class::Test::SQLite';
19
20     Thing->columns(All  => qw[thing_id this that date]);
21 }
22
23 my $thing = Thing->construct({ thing_id => 23, date => "01-02-1994" });
24 my $date = DateTime->now;
25 lives_ok {
26   $thing->set( date => $date );
27   $thing->set( date => $date );
28 };
29
30
31
32 $thing->discard_changes;