Test that DateTime objects can safely be updated twice (which is what triggers
[dbsrgits/DBIx-Class.git] / t / cdbi-t / set_vs_DateTime.t
CommitLineData
e60dc79f 1#!/usr/bin/perl -w
2
3use strict;
4use Test::More;
4c9f72c1 5use Test::Exception;
e60dc79f 6
7BEGIN {
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
23my $thing = Thing->construct({ thing_id => 23, date => "01-02-1994" });
4c9f72c1 24my $date = DateTime->now;
25lives_ok {
26 $thing->set( date => $date );
27 $thing->set( date => $date );
e60dc79f 28};
4c9f72c1 29
30
e60dc79f 31
32$thing->discard_changes;