Bug 14100: Fix Search.t tests
So, this one is VERY weird, let me try to explain what I have
understood.
Bisecting using run prove t/db_dependent/Search.t, I have found that the
following commit make the test fail:
commit
0f63f89f66e40cc01ef02da3654fcfb404c9001d
Bug 14100: Generic solution for language overlay - Item types
The error is
DBI bind_columns: invalid number of arguments: got handle + 0, expected handle + between 1 and -1
Usage: $h->bind_columns(\$var1 [, \$var2, ...]) at /usr/lib/i386-linux-gnu/perl5/5.20/DBI.pm line 2065.
Note that the interface (admin/itemtypes.pl) which calls the same
subroutine with the same parameter (style => 'array') works great.
The problem comes from the change in C4::Search::searchResults, if I
only apply the change done to this subroutine on
0f63f89f^1, I reproduce
the issue.
Looking closely at how %itemtypes is built, we could actually call
GetItemTypes with the style => 'hash' to get exactly what we want.
The following piece prove it for you:
use Test::More;
use C4::Koha;
my $i = GetItemTypes;
my $j = GetItemTypes(style => 'array');
my %itemtypes;
for my $itemtype ( @$j ) {
$itemtypes{ $itemtype->{itemtype} } = $itemtype;
}
is_deeply( \%itemtypes, $i);
So changing the code accordingly and just forget this last hour...
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>