From: Christopher H. Laco Date: Sun, 18 Jun 2006 20:20:40 +0000 (+0000) Subject: Added small create test that passes and existing DateTime object X-Git-Tag: v0.07002~75^2~106^2~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=da258aab4d07fb71644e42ccb88c2a579a866eeb;p=dbsrgits%2FDBIx-Class.git Added small create test that passes and existing DateTime object Tweaked is() tests to make older Test::More happy with DateTime stringification --- diff --git a/t/89inflate_datetime.t b/t/89inflate_datetime.t index 254348a..4145749 100644 --- a/t/89inflate_datetime.t +++ b/t/89inflate_datetime.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); @@ -10,12 +10,22 @@ my $schema = DBICTest->init_schema(); eval { require DateTime::Format::MySQL }; plan skip_all => "Need DateTime::Format::MySQL for inflation tests" if $@; -plan tests => 2; +plan tests => 4; # inflation test my $event = $schema->resultset("Event")->find(1); isa_ok($event->starts_at, 'DateTime', 'DateTime returned'); -is($event->starts_at, '2006-04-25T22:24:33', 'Correct date/time'); +# klunky, but makes older Test::More installs happy +my $starts = $event->starts_at . ''; +is($starts, '2006-04-25T22:24:33', 'Correct date/time'); +# create using DateTime +my $created = $schema->resultset('Event')->create({ + starts_at => DateTime->new(year=>2006, month=>6, day=>18) +}); +my $created_start = $created->starts_at; + +isa_ok($created->starts_at, 'DateTime', 'DateTime returned'); +is($created_start, '2006-06-18T00:00:00', 'Correct date/time');