Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 16; |
22 |
use Test::More tests => 15; |
23 |
|
23 |
|
24 |
use Koha::Database; |
24 |
use Koha::Database; |
25 |
use Koha::SearchFields; |
25 |
use Koha::SearchFields; |
Lines 73-83
my $smtf2 = $builder->build({
Link Here
|
73 |
}); |
73 |
}); |
74 |
|
74 |
|
75 |
my $search_field = Koha::SearchFields->find($sf->{id}); |
75 |
my $search_field = Koha::SearchFields->find($sf->{id}); |
76 |
my @marc_map = $search_field->search_marc_maps; |
76 |
my $marc_maps = $search_field->search_marc_maps; |
77 |
is(scalar(@marc_map), 1, 'search_marc_maps should return 1 marc map'); |
77 |
my $marc_map = $marc_maps->next; |
78 |
is($marc_map[0]->index_name, 'biblios', 'Marc map index name is biblios'); |
78 |
is($marc_maps->count, 1, 'search_marc_maps should return 1 marc map'); |
79 |
is($marc_map[0]->marc_type, 'marc21', 'Marc map type is marc21'); |
79 |
is($marc_map->get_column('index_name'), 'biblios', 'Marc map index name is biblios'); |
80 |
is($marc_map[0]->marc_field, '410abcdef', 'Marc map field is 410abcdef'); |
80 |
is($marc_map->get_column('marc_type'), 'marc21', 'Marc map type is marc21'); |
|
|
81 |
is($marc_map->get_column('marc_field'), '410abcdef', 'Marc map field is 410abcdef'); |
81 |
|
82 |
|
82 |
ok($search_field->is_mapped_biblios, 'Search field 1 is mapped with biblios'); |
83 |
ok($search_field->is_mapped_biblios, 'Search field 1 is mapped with biblios'); |
83 |
|
84 |
|
Lines 188-203
$builder->build({
Link Here
|
188 |
} |
189 |
} |
189 |
}); |
190 |
}); |
190 |
|
191 |
|
191 |
my ($w_fields, $weight) = Koha::SearchFields->weighted_fields(); |
192 |
my @w_fields = Koha::SearchFields->weighted_fields(); |
192 |
is(scalar(@$w_fields), 3, 'weighted_fields should return 3 weighted fields.'); |
193 |
is(scalar(@w_fields), 3, 'weighted_fields should return 3 weighted fields.'); |
193 |
is(scalar(@$weight), 3, 'weighted_fields should return 3 weight.'); |
|
|
194 |
|
194 |
|
195 |
is($w_fields->[0], 'title', 'First field is title.'); |
195 |
is($w_fields[0]->name, 'title', 'First field is title.'); |
196 |
is($w_fields->[1], 'subject', 'Second field is subject.'); |
196 |
is($w_fields[0]->weight, 25, 'Title weight is 25.'); |
197 |
is($w_fields->[2], 'author', 'Third field is author.'); |
197 |
is($w_fields[1]->name, 'subject', 'Second field is subject.'); |
198 |
|
198 |
is($w_fields[1]->weight, 15, 'Subject weight is 15.'); |
199 |
is($weight->[0], 25, 'Title weight is 25.'); |
199 |
is($w_fields[2]->name, 'author', 'Third field is author.'); |
200 |
is($weight->[1], 15, 'Subject weight is 15.'); |
200 |
is($w_fields[2]->weight, 5, 'Author weight is 5.'); |
201 |
is($weight->[2], 5, 'Author weight is 5.'); |
|
|
202 |
|
201 |
|
203 |
$schema->storage->txn_rollback; |
202 |
$schema->storage->txn_rollback; |
204 |
- |
|
|