View | Details | Raw Unified | Return to bug 16890
Collapse All | Expand All

(-)a/t/db_dependent/TestBuilder.t (-1 / +12 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 9;
22
use Test::More tests => 10;
23
use Test::Warn;
23
use Test::Warn;
24
use Data::Dumper qw(Dumper);
24
use Data::Dumper qw(Dumper);
25
25
Lines 321-326 subtest 'Auto-increment values tests' => sub { Link Here
321
        'Build should not overwrite an auto_incr column';
321
        'Build should not overwrite an auto_incr column';
322
};
322
};
323
323
324
subtest 'Date handling' => sub {
325
    plan tests => 2;
326
327
    $builder = t::lib::TestBuilder->new;
328
329
    my $patron = $builder->build( { source => 'Borrower' } );
330
    is( length( $patron->{updated_on} ),  19, 'A timestamp column value should be YYYY-MM-DD HH:MM:SS' );
331
    is( length( $patron->{dateofbirth} ), 10, 'A date column value should be YYYY-MM-DD' );
332
333
};
334
324
$schema->storage->txn_rollback;
335
$schema->storage->txn_rollback;
325
336
326
1;
337
1;
(-)a/t/lib/TestBuilder.pm (-3 / +7 lines)
Lines 325-332 sub _gen_type { Link Here
325
        decimal          => \&_gen_real,
325
        decimal          => \&_gen_real,
326
        double_precision => \&_gen_real,
326
        double_precision => \&_gen_real,
327
327
328
        timestamp => \&_gen_date,
328
        timestamp => \&_gen_datetime,
329
        datetime  => \&_gen_date,
329
        datetime  => \&_gen_datetime,
330
        date      => \&_gen_date,
330
        date      => \&_gen_date,
331
331
332
        char       => \&_gen_text,
332
        char       => \&_gen_text,
Lines 380-385 sub _gen_real { Link Here
380
380
381
sub _gen_date {
381
sub _gen_date {
382
    my ($self, $params) = @_;
382
    my ($self, $params) = @_;
383
    return $self->schema->storage->datetime_parser->format_date(DateTime->now())
384
}
385
386
sub _gen_datetime {
387
    my ($self, $params) = @_;
383
    return $self->schema->storage->datetime_parser->format_datetime(DateTime->now());
388
    return $self->schema->storage->datetime_parser->format_datetime(DateTime->now());
384
}
389
}
385
390
386
- 

Return to bug 16890