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