Reorganize CDBICompat tests - centralize prereq checks in one place
[dbsrgits/DBIx-Class.git] / t / cdbi / set_to_undef.t
CommitLineData
4c9f72c1 1use strict;
2use Test::More;
d9bd5195 3
97d61088 4use lib 't/cdbi/testlib';
d9bd5195 5use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
4c9f72c1 6
7BEGIN {
d9bd5195 8 eval { require DateTime; DateTime->VERSION(0.55) }
9 or plan skip_all => 'DateTime 0.55 required for this test';
4c9f72c1 10}
11
1f17ec27 12
13# Don't use Test::NoWarnings because of an unrelated DBD::SQLite warning.
14my @warnings;
15local $SIG{__WARN__} = sub {
16 push @warnings, @_;
17};
14e38771 18
4c9f72c1 19{
20 package Thing;
21
97d61088 22 use base 'DBIC::Test::SQLite';
4c9f72c1 23
24 Thing->columns(All => qw[thing_id this that date]);
25}
26
27my $thing = Thing->construct({ thing_id => 23, this => 42 });
28$thing->set( this => undef );
1f17ec27 29is $thing->get( "this" ), undef, 'undef set';
4c9f72c1 30$thing->discard_changes;
1f17ec27 31
32is @warnings, 0, 'no warnings';
d9bd5195 33
34done_testing;