View | Details | Raw Unified | Return to bug 20589
Collapse All | Expand All

(-)a/t/db_dependent/Koha/SearchField.t (-66 / +1 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 15;
22
use Test::More tests => 8;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::SearchFields;
25
use Koha::SearchFields;
Lines 135-202 ok(!$search_field->is_mapped_biblios, 'Search field is not mapped'); Link Here
135
135
136
Koha::SearchFields->search({})->delete;
136
Koha::SearchFields->search({})->delete;
137
137
138
$builder->build({
139
    source => 'SearchField',
140
    value => {
141
        name    => 'acqdate',
142
        label   => 'acqdate',
143
        weight  => undef
144
    }
145
});
146
147
$builder->build({
148
    source => 'SearchField',
149
    value => {
150
        name    => 'copydate',
151
        label   => 'copydate',
152
        weight  => undef
153
    }
154
});
155
156
$builder->build({
157
    source => 'SearchField',
158
    value => {
159
        name    => 'ccode',
160
        label   => 'ccode',
161
        weight  => 0
162
    }
163
});
164
165
$builder->build({
166
    source => 'SearchField',
167
    value => {
168
        name    => 'title',
169
        label   => 'title',
170
        weight  => 25
171
    }
172
});
173
174
$builder->build({
175
    source => 'SearchField',
176
    value => {
177
        name    => 'subject',
178
        label   => 'subject',
179
        weight  => 15
180
    }
181
});
182
183
$builder->build({
184
    source => 'SearchField',
185
    value => {
186
        name    => 'author',
187
        label   => 'author',
188
        weight  => 5
189
    }
190
});
191
192
my @w_fields = Koha::SearchFields->weighted_fields();
193
is(scalar(@w_fields), 3, 'weighted_fields should return 3 weighted fields.');
194
195
is($w_fields[0]->name, 'title', 'First field is title.');
196
is($w_fields[0]->weight+0, 25, 'Title weight is 25.');
197
is($w_fields[1]->name, 'subject', 'Second field is subject.');
198
is($w_fields[1]->weight+0, 15, 'Subject weight is 15.');
199
is($w_fields[2]->name, 'author', 'Third field is author.');
200
is($w_fields[2]->weight+0, 5, 'Author weight is 5.');
201
202
$schema->storage->txn_rollback;
138
$schema->storage->txn_rollback;
203
- 

Return to bug 20589