Bug 18316: (follow-up) Fix tests and update statement
Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
74198af0fe
commit
0bfcac5a07
3 changed files with 8 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
if( !column_exists( 'search_field', 'weight' ) ) {
|
||||
$dbh->do( "ALTER TABLE `search_field` ADD COLUMN `weight` decimal(5,2) DEFAULT NULL" );
|
||||
$dbh->do( "ALTER TABLE `search_field` ADD COLUMN `weight` decimal(5,2) DEFAULT NULL AFTER `type`" );
|
||||
}
|
||||
|
||||
SetVersion( $DBversion );
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 2;
|
||||
use C4::Context;
|
||||
use Test::Exception;
|
||||
use t::lib::TestBuilder;
|
||||
use Test::More tests => 3;
|
||||
|
||||
use Koha::Database;
|
||||
|
@ -160,11 +160,10 @@ subtest 'build_query with weighted fields tests' => sub {
|
|||
undef, undef, undef, { weighted_fields => 1 });
|
||||
|
||||
my $fields = $query->{query}{query_string}{fields};
|
||||
|
||||
is(scalar(@$fields), 3, 'Search is done on 3 fields');
|
||||
is($fields->[0], '_all', 'First search field is _all');
|
||||
is($fields->[1], 'title^25', 'Second search field is title');
|
||||
is($fields->[2], 'subject^15', 'Third search field is subject');
|
||||
is($fields->[1], 'title^25.00', 'Second search field is title');
|
||||
is($fields->[2], 'subject^15.00', 'Third search field is subject');
|
||||
};
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
|
@ -193,10 +193,10 @@ my @w_fields = Koha::SearchFields->weighted_fields();
|
|||
is(scalar(@w_fields), 3, 'weighted_fields should return 3 weighted fields.');
|
||||
|
||||
is($w_fields[0]->name, 'title', 'First field is title.');
|
||||
is($w_fields[0]->weight, 25, 'Title weight is 25.');
|
||||
is($w_fields[0]->weight+0, 25, 'Title weight is 25.');
|
||||
is($w_fields[1]->name, 'subject', 'Second field is subject.');
|
||||
is($w_fields[1]->weight, 15, 'Subject weight is 15.');
|
||||
is($w_fields[1]->weight+0, 15, 'Subject weight is 15.');
|
||||
is($w_fields[2]->name, 'author', 'Third field is author.');
|
||||
is($w_fields[2]->weight, 5, 'Author weight is 5.');
|
||||
is($w_fields[2]->weight+0, 5, 'Author weight is 5.');
|
||||
|
||||
$schema->storage->txn_rollback;
|
Loading…
Reference in a new issue