# create using DateTime
my $created = $schema->resultset('Event')->create({
- starts_at => DateTime->new(year=>2006, month=>6, day=>18)
+ starts_at => DateTime->new(year=>2006, month=>6, day=>18),
+ created_on => DateTime->new(year=>2006, month=>6, day=>23)
});
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');
+
+## timestamp field
+isa_ok($event->created_on, 'DateTime', 'DateTime returned');
+
+# klunky, but makes older Test::More installs happy
+my $createo = $event->created_on . '';
+is($createo, '2006-06-22T21:00:05', 'Correct date/time');
+
+my $created_cron = $created->created_on;
+
+isa_ok($created->created_on, 'DateTime', 'DateTime returned');
+is($created_cron, '2006-06-23T00:00:00', 'Correct date/time');
]);
$schema->populate('Event', [
- [ qw/id starts_at/ ],
- [ 1, '2006-04-25 22:24:33' ],
+ [ qw/id starts_at created_on/ ],
+ [ 1, '2006-04-25 22:24:33', '2006-06-22 21:00:05'],
]);
$schema->populate('Link', [
__PACKAGE__->add_columns(
id => { data_type => 'integer', is_auto_increment => 1 },
- starts_at => { data_type => 'datetime' }
+ starts_at => { data_type => 'datetime' },
+ created_on => { data_type => 'timestamp' }
);
__PACKAGE__->set_primary_key('id');