Bugzilla – Attachment 102086 Details for
Bug 25008
Koha::RecordProcessor->options doesn't refresh the filters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25008: Regression tests
Bug-25008-Regression-tests.patch (text/plain), 2.20 KB, created by
Jonathan Druart
on 2020-03-30 14:26:03 UTC
(
hide
)
Description:
Bug 25008: Regression tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-30 14:26:03 UTC
Size:
2.20 KB
patch
obsolete
>From 8ca6ef256484ba47e566cae11b73ba8454713c68 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 27 Mar 2020 17:53:32 -0300 >Subject: [PATCH] Bug 25008: Regression tests > >This patch highlights a behaviour of Koha::RecordProcessor that is >unexpected: if you change the original options using ->options, the >loaded filters don't pick the change. That's because the filter objects >are loaded on ->new, and they are never updated. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/RecordProcessor.t >=> FAIL: Test prove ->options doesn't update the filters! > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/RecordProcessor.t | 51 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > >diff --git a/t/RecordProcessor.t b/t/RecordProcessor.t >index 63683c1b23..aab2b3c0f5 100755 >--- a/t/RecordProcessor.t >+++ b/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(); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25008
:
102019
|
102082
|
102083
|
102086
|
102087
|
102088
|
102806
|
102807
|
102808