X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Finflate%2Fdatetime_pg.t;h=2b19df47a08642927b8e4c4f535768876d3f27f2;hb=a33d2444e0981129eb060521de27c5e2104f37ba;hp=054edf1f672670302b4d98df7e0b3c4d6cb0834c;hpb=40f751811e773082d1cc654f15f06ef65749a9e9;p=dbsrgits%2FDBIx-Class.git diff --git a/t/inflate/datetime_pg.t b/t/inflate/datetime_pg.t index 054edf1..2b19df4 100644 --- a/t/inflate/datetime_pg.t +++ b/t/inflate/datetime_pg.t @@ -13,7 +13,7 @@ use DBICTest; eval { require DateTime::Format::Pg }; plan $@ ? ( skip_all => 'Need DateTime::Format::Pg for timestamp inflation tests') - : ( tests => 3 ) + : ( tests => 6 ) ; @@ -27,4 +27,14 @@ my $schema = DBICTest->init_schema(); is($event->created_on->time_zone->name, "America/Chicago", "Timezone changed"); # Time zone difference -> -6hours is($event->created_on->iso8601, "2009-01-15T11:00:00", "Time with TZ correct"); + +# test 'timestamp without time zone' + my $dt = DateTime->from_epoch(epoch => time); + $dt->set_nanosecond(int 500_000_000); + $event->update({ts_without_tz => $dt}); + $event->discard_changes; + isa_ok($event->ts_without_tz, "DateTime") or diag $event->created_on; + is($event->ts_without_tz, $dt, 'timestamp without time zone inflation'); + is($event->ts_without_tz->microsecond, $dt->microsecond, + 'timestamp without time zone microseconds survived'); }