Fix building on perls with no . in @INC
[dbsrgits/DBIx-Class.git] / t / resultset / create_with_rs_inherited_values.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8 use Math::BigInt;
9
10
11 use DBICTest;
12
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  {
30    my $dt = Math::BigInt->new(2006);
31
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 {
57     $artist = $artist_rs->search({ name => [ qw(some stupid names here) ]})
58       ->create({artistid => undef});
59   };
60   is($artist->name, undef);
61 }
62
63 done_testing;