Bugzilla – Attachment 41391 Details for
Bug 14646
Koha::RecordProcessor only accepts one filter at a time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14646: (regression test) Koha::RecordProcessor only accepts one filter at a time
Bug-14646-regression-test-KohaRecordProcessor-only.patch (text/plain), 2.96 KB, created by
Mark Tompsett
on 2015-08-05 22:14:36 UTC
(
hide
)
Description:
Bug 14646: (regression test) Koha::RecordProcessor only accepts one filter at a time
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-08-05 22:14:36 UTC
Size:
2.96 KB
patch
obsolete
>From bac44060f2a1e534a9636a4378f7dacbdc8f4412 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 4 Aug 2015 18:43:01 -0300 >Subject: [PATCH] Bug 14646: (regression test) Koha::RecordProcessor only > accepts one filter at a time > >This patch introduces new tests to t/RecordProcessor.t so it tests for >creating processors with more than one filter. It does so by running > > my $processor = new Koha::RecordProcessor({ > filters => ['Null','Dummy'] > }); > >and testing the results. > >To test: >- Apply the patch >- Run: > $ prove t/RecordProcessor.t >=> FAIL: tests related to multiple filters fail. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > t/RecordProcessor.t | 37 +++++++++++++++++++++++++++++++++++-- > 1 file changed, 35 insertions(+), 2 deletions(-) > >diff --git a/t/RecordProcessor.t b/t/RecordProcessor.t >index 7758e32..850ad39 100755 >--- a/t/RecordProcessor.t >+++ b/t/RecordProcessor.t >@@ -17,8 +17,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; >+ > use File::Spec; > use MARC::Record; > >@@ -77,4 +77,37 @@ eval { > > ok(!$@, 'Destroyed processor successfully'); > >+subtest "new() tests" => sub { >+ >+ plan tests => 13; >+ >+ my $processor; >+ >+ # Create a processor with a valid filter >+ $processor = new Koha::RecordProcessor({ filters => 'Null' }); >+ is( ref($processor), 'Koha::RecordProcessor', 'Processor created' ); >+ is( scalar @{ $processor->filters }, 1, 'One filter initialized' ); >+ is( ref($processor->filters->[0]), 'Koha::Filter::MARC::Null', 'Correct filter initialized' ); >+ >+ # Create a processor with an invalid filter >+ $processor = new Koha::RecordProcessor({ filters => 'Dummy' }); >+ is( ref($processor), 'Koha::RecordProcessor', 'Processor created' ); >+ is( scalar @{ $processor->filters }, 0, 'No filter initialized' ); >+ is( ref($processor->filters->[0]), '', 'Make sure no filter initialized' ); >+ >+ # Create a processor with two valid filters >+ $processor = new Koha::RecordProcessor({ filters => [ 'Null', 'EmbedSeeFromHeadings' ] }); >+ is( ref($processor), 'Koha::RecordProcessor', 'Processor created' ); >+ is( scalar @{ $processor->filters }, 2, 'Two filters initialized' ); >+ is( ref($processor->filters->[0]), 'Koha::Filter::MARC::Null', 'Correct first filter initialized' ); >+ is( ref($processor->filters->[1]), 'Koha::Filter::MARC::EmbedSeeFromHeadings', 'Correct second filter initialized' ); >+ >+ # Create a processor with both valid and invalid filters. >+ $processor = new Koha::RecordProcessor({ filters => [ 'Null', 'Dummy' ] }); >+ is( ref($processor), 'Koha::RecordProcessor', 'Processor created' ); >+ is( scalar @{ $processor->filters }, 1, 'Invalid filter skipped' ); >+ is( ref($processor->filters->[0]), 'Koha::Filter::MARC::Null', 'Correct filter initialized' ); >+ >+}; >+ > done_testing(); >-- >2.1.4
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 14646
:
41388
|
41389
|
41391
|
41392
|
41655
|
41656