Lines 149-152
subtest 'new() tests' => sub {
Link Here
|
149 |
is_deeply( $filter_params, $parameters, 'Initialization parameters' ); |
149 |
is_deeply( $filter_params, $parameters, 'Initialization parameters' ); |
150 |
}; |
150 |
}; |
151 |
|
151 |
|
|
|
152 |
subtest 'options() tests' => sub { |
153 |
|
154 |
plan tests => 4; |
155 |
|
156 |
# Create a processor with some options |
157 |
my $record_processor = Koha::RecordProcessor->new( |
158 |
{ |
159 |
filters => ['EmbedSeeFromHeadings','Null'], |
160 |
options => { |
161 |
dummy => 'something' |
162 |
} |
163 |
} |
164 |
); |
165 |
|
166 |
my $filter = $record_processor->filters->[0]; |
167 |
|
168 |
is( |
169 |
ref( $filter ), |
170 |
'Koha::Filter::MARC::EmbedSeeFromHeadings', |
171 |
'Correct second filter initialized' |
172 |
); |
173 |
|
174 |
is_deeply( |
175 |
$filter->params->{options}, |
176 |
{ dummy => 'something' }, |
177 |
'Options are set correctly' |
178 |
); |
179 |
|
180 |
# Update the chosen options |
181 |
$record_processor->options( |
182 |
{ |
183 |
dummy => 'something else' |
184 |
} |
185 |
); |
186 |
|
187 |
# Re-fetch the filter |
188 |
$filter = $record_processor->filters->[0]; |
189 |
|
190 |
is( |
191 |
ref( $filter ), |
192 |
'Koha::Filter::MARC::EmbedSeeFromHeadings', |
193 |
'Correct second filter initialized' |
194 |
); |
195 |
|
196 |
is_deeply( |
197 |
$filter->params->{options}, |
198 |
{ dummy => 'something else' }, |
199 |
'Options are updated correctly' |
200 |
); |
201 |
}; |
202 |
|
152 |
done_testing(); |
203 |
done_testing(); |
153 |
- |
|
|