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