Sketches of tests that should ultimately pass
[dbsrgits/DBIx-Class.git] / t / 96_is_deteministic_value.t
1 use strict;
2 use warnings;
3
4 # 6 tests
5
6 use Test::More;
7 use lib qw(t/lib);
8 use DBICTest;
9 plan skip_all => "DateTime required" unless eval { require DateTime };
10 eval "use DateTime::Format::Strptime";
11 plan skip_all => 'DateTime::Format::Strptime required' if $@;
12 plan 'no_plan';
13 use Test::Exception;
14
15 my $schema = DBICTest->init_schema();
16 my $artist_rs = $schema->resultset('Artist');
17 my $cd_rs = $schema->resultset('CD');
18
19  {
20    my $cd;
21    lives_ok {
22      $cd = $cd_rs->search({ year => {'=' => 1999}})->create
23        ({
24          artist => {name => 'Guillermo1'},
25          title => 'Guillermo 1',
26         });
27    };
28    is($cd->year, 1999);
29  }
30
31  {
32    my $formatter = DateTime::Format::Strptime->new(pattern => '%Y');
33    my $dt = DateTime->new(year => 2006, month => 06, day => 06,
34                           formatter => $formatter );
35    my $cd;
36    lives_ok {
37      $cd = $cd_rs->search({ year => $dt})->create
38        ({
39          artist => {name => 'Guillermo2'},
40          title => 'Guillermo 2',
41         });
42    };
43    is($cd->year, 2006);
44  }
45
46
47 {
48   my $artist;
49   lives_ok {
50     $artist = $artist_rs->search({ name => {'!=' => 'Killer'}})
51       ->create({artistid => undef});
52   };
53   is($artist->name, undef);
54 }
55
56
57 {
58   my $artist;
59   lives_ok {
60     $artist = $artist_rs->search({ name => [ q/ some stupid names here/]})
61       ->create({artistid => undef});
62   };
63   is($artist->name, undef);
64 }
65
66
67 1;