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