Switch the main dev branch back to 'master'
[dbsrgits/DBIx-Class.git] / t / resultset / create_with_rs_inherited_values.t
CommitLineData
561f003c 1use strict;
2use warnings;
3
c959e8d0 4use Test::More;
68de9438 5use Test::Exception;
1f5d74ae 6use Math::BigInt;
68de9438 7
4bea1fe7 8use lib qw(t/lib);
9use DBICTest;
10
561f003c 11my $schema = DBICTest->init_schema();
12my $artist_rs = $schema->resultset('Artist');
13my $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 61done_testing;