Bug 15777 - Test to prove initialization isn't working correctly.
authorMark Tompsett <mtompset@hotmail.com>
Wed, 10 Feb 2016 16:18:40 +0000 (11:18 -0500)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 24 Feb 2016 01:39:39 +0000 (01:39 +0000)
TEST PLAN
---------
1) Apply this testing patch
2) prove -v t/RecordProcessor.t
   -- tests will fail.
3) run koha qa test tools

Signed-off-by: Marc VĂ©ron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com

t/RecordProcessor.t

index 850ad39..ad475d4 100755 (executable)
@@ -79,7 +79,7 @@ ok(!$@, 'Destroyed processor successfully');
 
 subtest "new() tests" => sub {
 
-    plan tests => 13;
+    plan tests => 14;
 
     my $processor;
 
@@ -103,11 +103,18 @@ subtest "new() tests" => sub {
     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' ] });
+    # use hash reference for regression testing
+    my $parameters = {
+        filters => [ 'Null', 'Dummy' ],
+        options => { 'test' => 'true' }
+    };
+    $processor = new Koha::RecordProcessor($parameters);
     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' );
 
+    my $filter_params = $processor->filters->[0]->params;
+    is_deeply( $filter_params, $parameters, 'Initialization parameters' );
 };
 
 done_testing();