Remove DateTime requirement from tests that do not rely on it
[dbsrgits/DBIx-Class.git] / t / resultset / create_with_rs_inherited_values.t
diff --git a/t/resultset/create_with_rs_inherited_values.t b/t/resultset/create_with_rs_inherited_values.t
new file mode 100644 (file)
index 0000000..8a0acd3
--- /dev/null
@@ -0,0 +1,61 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+use Math::BigInt;
+
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+my $artist_rs = $schema->resultset('Artist');
+my $cd_rs = $schema->resultset('CD');
+
+ {
+   my $cd;
+   lives_ok {
+     $cd = $cd_rs->search({ year => {'=' => 1999}})->create
+       ({
+         artist => {name => 'Guillermo1'},
+         title => 'Guillermo 1',
+        });
+   };
+   is($cd->year, 1999);
+ }
+
+ {
+   my $dt = Math::BigInt->new(2006);
+
+   my $cd;
+   lives_ok {
+     $cd = $cd_rs->search({ year => $dt})->create
+       ({
+         artist => {name => 'Guillermo2'},
+         title => 'Guillermo 2',
+        });
+   };
+   is($cd->year, 2006);
+ }
+
+
+{
+  my $artist;
+  lives_ok {
+    $artist = $artist_rs->search({ name => {'!=' => 'Killer'}})
+      ->create({artistid => undef});
+  };
+  is($artist->name, undef);
+}
+
+
+{
+  my $artist;
+  lives_ok {
+    $artist = $artist_rs->search({ name => [ qw(some stupid names here) ]})
+      ->create({artistid => undef});
+  };
+  is($artist->name, undef);
+}
+
+done_testing;