Commit | Line | Data |
c0329273 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
2 | |
561f003c |
3 | use strict; |
4 | use warnings; |
5 | |
c959e8d0 |
6 | use Test::More; |
68de9438 |
7 | use Test::Exception; |
1f5d74ae |
8 | use Math::BigInt; |
68de9438 |
9 | |
c0329273 |
10 | |
4bea1fe7 |
11 | use DBICTest; |
12 | |
561f003c |
13 | my $schema = DBICTest->init_schema(); |
14 | my $artist_rs = $schema->resultset('Artist'); |
15 | my $cd_rs = $schema->resultset('CD'); |
16 | |
17 | { |
18 | my $cd; |
19 | lives_ok { |
20 | $cd = $cd_rs->search({ year => {'=' => 1999}})->create |
21 | ({ |
22 | artist => {name => 'Guillermo1'}, |
23 | title => 'Guillermo 1', |
24 | }); |
25 | }; |
26 | is($cd->year, 1999); |
27 | } |
28 | |
29 | { |
1f5d74ae |
30 | my $dt = Math::BigInt->new(2006); |
31 | |
561f003c |
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; |