Massive cleanup of DateTime test dependencies, other interim
[dbsrgits/DBIx-Class.git] / t / 96_is_deteministic_value.t
CommitLineData
561f003c 1use strict;
2use warnings;
3
c959e8d0 4use Test::More;
68de9438 5use Test::Exception;
6
7BEGIN {
8 require DBIx::Class;
9 plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
10 unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
11}
12
561f003c 13use lib qw(t/lib);
14use DBICTest;
561f003c 15
16my $schema = DBICTest->init_schema();
17my $artist_rs = $schema->resultset('Artist');
18my $cd_rs = $schema->resultset('CD');
19
20 {
21 my $cd;
22 lives_ok {
23 $cd = $cd_rs->search({ year => {'=' => 1999}})->create
24 ({
25 artist => {name => 'Guillermo1'},
26 title => 'Guillermo 1',
27 });
28 };
29 is($cd->year, 1999);
30 }
31
32 {
33 my $formatter = DateTime::Format::Strptime->new(pattern => '%Y');
34 my $dt = DateTime->new(year => 2006, month => 06, day => 06,
35 formatter => $formatter );
36 my $cd;
37 lives_ok {
38 $cd = $cd_rs->search({ year => $dt})->create
39 ({
40 artist => {name => 'Guillermo2'},
41 title => 'Guillermo 2',
42 });
43 };
44 is($cd->year, 2006);
45 }
46
47
48{
49 my $artist;
50 lives_ok {
51 $artist = $artist_rs->search({ name => {'!=' => 'Killer'}})
52 ->create({artistid => undef});
53 };
54 is($artist->name, undef);
55}
56
57
58{
59 my $artist;
60 lives_ok {
61 $artist = $artist_rs->search({ name => [ q/ some stupid names here/]})
62 ->create({artistid => undef});
63 };
64 is($artist->name, undef);
65}
66
89bddb49 67done_testing;