Bugzilla – Attachment 53353 Details for
Bug 16890
TestBuilder always generate datetime for dates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 16890: Make TestBuilder generate date for date columns (and not datetime)
PASSED-QA-Bug-16890-Make-TestBuilder-generate-date.patch (text/plain), 2.44 KB, created by
Katrin Fischer
on 2016-07-12 21:18:24 UTC
(
hide
)
Description:
[PASSED QA] Bug 16890: Make TestBuilder generate date for date columns (and not datetime)
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-07-12 21:18:24 UTC
Size:
2.44 KB
patch
obsolete
>From a2438c033e15f43a747c7d1851d9aaae745d38d9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 9 Jul 2016 15:56:32 +0100 >Subject: [PATCH] [PASSED QA] Bug 16890: Make TestBuilder generate date for > date columns (and not datetime) > >TestBuilder should not generate datetime for date columns, but only for >datetime and timestamp columns. > >Test plan: >Make sure the change in t/db_dependent/TestBuilder.t are consistent. >Before this patch, 1 of the 2 tests should fail. >After this patch applied, they both should pass. > >Signed-off-by: Srdjan <srdjan@catalyst.net.nz> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/TestBuilder.t | 13 ++++++++++++- > t/lib/TestBuilder.pm | 9 +++++++-- > 2 files changed, 19 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t >index 569b6b4..3046ad8 100644 >--- a/t/db_dependent/TestBuilder.t >+++ b/t/db_dependent/TestBuilder.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 9; >+use Test::More tests => 10; > use Test::Warn; > use Data::Dumper qw(Dumper); > >@@ -321,6 +321,17 @@ subtest 'Auto-increment values tests' => sub { > 'Build should not overwrite an auto_incr column'; > }; > >+subtest 'Date handling' => sub { >+ plan tests => 2; >+ >+ $builder = t::lib::TestBuilder->new; >+ >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ is( length( $patron->{updated_on} ), 19, 'A timestamp column value should be YYYY-MM-DD HH:MM:SS' ); >+ is( length( $patron->{dateofbirth} ), 10, 'A date column value should be YYYY-MM-DD' ); >+ >+}; >+ > $schema->storage->txn_rollback; > > 1; >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index ed28458..666cc87 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -325,8 +325,8 @@ sub _gen_type { > decimal => \&_gen_real, > double_precision => \&_gen_real, > >- timestamp => \&_gen_date, >- datetime => \&_gen_date, >+ timestamp => \&_gen_datetime, >+ datetime => \&_gen_datetime, > date => \&_gen_date, > > char => \&_gen_text, >@@ -380,6 +380,11 @@ sub _gen_real { > > sub _gen_date { > my ($self, $params) = @_; >+ return $self->schema->storage->datetime_parser->format_date(DateTime->now()) >+} >+ >+sub _gen_datetime { >+ my ($self, $params) = @_; > return $self->schema->storage->datetime_parser->format_datetime(DateTime->now()); > } > >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16890
:
53246
|
53298
| 53353