Add strict/warnings test, adjust all offenders (wow, that was a lot)
[dbsrgits/DBIx-Class.git] / t / cdbi / set_to_undef.t
1 use strict;
2 use warnings;
3 use Test::More;
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 # Don't use Test::NoWarnings because of an unrelated DBD::SQLite warning.
15 my @warnings;
16 local $SIG{__WARN__} = sub {
17     push @warnings, @_;
18 };
19
20 {
21     package Thing;
22
23     use base 'DBIC::Test::SQLite';
24
25     Thing->columns(All  => qw[thing_id this that date]);
26 }
27
28 my $thing = Thing->construct({ thing_id => 23, this => 42 });
29 $thing->set( this => undef );
30 is $thing->get( "this" ), undef, 'undef set';
31 $thing->discard_changes;
32
33 is @warnings, 0, 'no warnings';
34
35 done_testing;