How ::Rekey was tested against the DBIC test suite
[dbsrgits/DBIx-Class.git] / t / inflate / datetime_firebird.t
index 1a3136e..0f62161 100644 (file)
@@ -1,5 +1,5 @@
 use strict;
-use warnings;  
+use warnings;
 
 use Test::More;
 use Test::Exception;
@@ -7,8 +7,6 @@ use lib qw(t/lib);
 use DBICTest;
 use Scope::Guard ();
 
-# XXX we're only testing TIMESTAMP here
-
 my ($dsn, $user, $pass)    = @ENV{map { "DBICTEST_FIREBIRD_${_}" }      qw/DSN USER PASS/};
 my ($dsn2, $user2, $pass2) = @ENV{map { "DBICTEST_FIREBIRD_ODBC_${_}" } qw/DSN USER PASS/};
 
@@ -18,13 +16,11 @@ Set $ENV{DBICTEST_FIREBIRD_DSN} and/or $ENV{DBICTEST_FIREBIRD_ODBC_DSN}
 _USER and _PASS to run this test'.
 Warning: This test drops and creates a table called 'event'";
 EOF
-} else {
-  eval "use DateTime; use DateTime::Format::Strptime;";
-  if ($@) {
-    plan skip_all => 'needs DateTime and DateTime::Format::Strptime for testing';
-  }
 }
 
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+  unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
+
 my @info = (
   [ $dsn,  $user,  $pass  ],
   [ $dsn2, $user2, $pass2 ],
@@ -53,10 +49,10 @@ foreach my $conn_idx (0..$#info) {
     "created_on" TIMESTAMP
   )
 SQL
-  my $rs   = $schema->resultset('Event');
+  my $rs = $schema->resultset('Event');
 
   my $dt = DateTime->now;
-  $dt->set_nanosecond($dsn =~ /odbc/i ? 0 : 555600000);
+  $dt->set_nanosecond(555600000);
 
   my $date_only = DateTime->new(
     year => $dt->year, month => $dt->month, day => $dt->day
@@ -74,7 +70,7 @@ SQL
   is $row->created_on, $dt, 'TIMESTAMP as DateTime roundtrip';
 
   cmp_ok $row->created_on->nanosecond, '==', $dt->nanosecond,
-    'fractional part of a second survived' if 0+$dt->nanosecond;
+    'fractional part of a second survived';
 
   is $row->starts_at, $date_only, 'DATE as DateTime roundtrip';
 }