@@ -, +, @@ $ kshell k$ prove t/RecordProcessor.t --- t/RecordProcessor.t | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) --- a/t/RecordProcessor.t +++ a/t/RecordProcessor.t @@ -149,4 +149,55 @@ subtest 'new() tests' => sub { is_deeply( $filter_params, $parameters, 'Initialization parameters' ); }; +subtest 'options() tests' => sub { + + plan tests => 4; + + # Create a processor with some options + my $record_processor = Koha::RecordProcessor->new( + { + filters => ['EmbedSeeFromHeadings','Null'], + options => { + dummy => 'something' + } + } + ); + + my $filter = $record_processor->filters->[0]; + + is( + ref( $filter ), + 'Koha::Filter::MARC::EmbedSeeFromHeadings', + 'Correct second filter initialized' + ); + + is_deeply( + $filter->params->{options}, + { dummy => 'something' }, + 'Options are set correctly' + ); + + # Update the chosen options + $record_processor->options( + { + dummy => 'something else' + } + ); + + # Re-fetch the filter + $filter = $record_processor->filters->[0]; + + is( + ref( $filter ), + 'Koha::Filter::MARC::EmbedSeeFromHeadings', + 'Correct second filter initialized' + ); + + is_deeply( + $filter->params->{options}, + { dummy => 'something else' }, + 'Options are updated correctly' + ); +}; + done_testing(); --