From eb36b35d3228dd67feb547459c9e0132251da74d Mon Sep 17 00:00:00 2001 From: Martin Persson Date: Tue, 8 Dec 2015 20:55:01 +0100 Subject: [PATCH] Bug 15339: TestBuilder warnings (code) Makes TestBuilder::build() alert the user when unreognized parameters are passed, which happens when the user supplies the column values directly, forgetting the 'value' hash. This patch holds the code changes. Examples of the kind of errors that it catches are in the tests (separate patch). Sponsored-By: Halland County Library --- t/lib/TestBuilder.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index 254af61..e09f54e 100644 --- a/t/lib/TestBuilder.pm +++ b/t/lib/TestBuilder.pm @@ -3,7 +3,7 @@ package t::lib::TestBuilder; use Modern::Perl; use Koha::Database; use String::Random; - +use Carp; my $gen_type = { tinyint => \&_gen_int, @@ -98,6 +98,9 @@ sub build { my $value = $params->{value}; my $only_fk = $params->{only_fk} || 0; + my @unknowns = grep( !/source|value|only_fk/, keys %{ $params }); + carp "Unknown parameter(s): ", join( ', ', @unknowns ) if scalar @unknowns; + my $col_values = $self->_buildColumnValues({ source => $source, value => $value, -- 2.1.4