Bug 36593: Add 'time' column type support to TestBuilder
This simple patch adds support for the 'time' column type. To test: 1. Run: $ ktd --shell k$ perl -Mt::lib::TestBuilder -e 'my $b = t::lib::TestBuilder->new; my $hour = $b->build_object({ class => "Koha::Library::Hours" });' => FAIL: It explodes as it doesn't know how to deal with the 'time' column type 2. Apply this patch and the follow-up 3. Run: k$ prove -MDDP -Mt::lib::TestBuilder -e 'my $b = t::lib::TestBuilder->new; my $h = $b->build_object({ class => "Koha::Library::Hours" }); p($h->unblessed);' => SUCCESS: It generates an hour! 4. Run: k$ prove t/db_dependent/TestBuilder.t => SUCCESS: It builds all the things! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
9c2510ea2e
commit
86f917e2bd
1 changed files with 6 additions and 0 deletions
|
@ -467,6 +467,7 @@ sub _gen_type {
|
|||
decimal => \&_gen_real,
|
||||
double_precision => \&_gen_real,
|
||||
|
||||
time => \&_gen_time,
|
||||
timestamp => \&_gen_datetime,
|
||||
datetime => \&_gen_datetime,
|
||||
date => \&_gen_date,
|
||||
|
@ -536,6 +537,11 @@ sub _gen_datetime {
|
|||
return $self->schema->storage->datetime_parser->format_datetime(dt_from_string);
|
||||
}
|
||||
|
||||
sub _gen_time {
|
||||
my ( $self, $params ) = @_;
|
||||
return $self->schema->storage->datetime_parser->format_time(dt_from_string);
|
||||
}
|
||||
|
||||
sub _gen_text {
|
||||
my ($self, $params) = @_;
|
||||
# From perldoc String::Random
|
||||
|
|
Loading…
Reference in a new issue