X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F73oracle_inflate.t;h=949a6c32e123cb8d9f39d153c86568d242a48681;hb=9900b5695787f3292eb51df9a0a0f86ea42210c4;hp=0f2fc2393220af64efbf0098b02c6d4f1efeab3e;hpb=99a836c181ec6f90907652499091709a195ba6ee;p=dbsrgits%2FDBIx-Class.git diff --git a/t/73oracle_inflate.t b/t/73oracle_inflate.t index 0f2fc23..949a6c3 100644 --- a/t/73oracle_inflate.t +++ b/t/73oracle_inflate.t @@ -17,7 +17,7 @@ else { plan skip_all => 'needs DateTime and DateTime::Format::Oracle for testing'; } else { - plan tests => 7; + plan tests => 9; } } @@ -67,9 +67,33 @@ $track->update; is( $track->last_updated_on->month, $dt->month, "deflate ok"); is( int $track->last_updated_at->nanosecond, int $dt->nanosecond, "deflate ok with nanosecond precision"); +# test datetime_setup + +$schema->storage->disconnect; + +delete $ENV{NLS_DATE_FORMAT}; +delete $ENV{NLS_TIMESTAMP_FORMAT}; + +$schema->connection($dsn, $user, $pass, { + on_connect_call => 'datetime_setup' +}); + +$dt = DateTime->now(); + +my $timestamp = $dt->clone; +$timestamp->millisecond( 80 ); + +$track = $schema->resultset('Track')->find( 1 ); +$track->update({ last_updated_on => $dt, last_updated_at => $timestamp }); + +$track = $schema->resultset('Track')->find(1); + +is( $track->last_updated_on, $dt, 'DateTime round-trip as DATE' ); +is( $track->last_updated_at, $timestamp, 'DateTime round-trip as TIMESTAMP' ); + # clean up our mess END { - if($dbh) { + if($schema && ($dbh = $schema->storage->dbh)) { $dbh->do("DROP TABLE track"); } }