From 7689b5f6ef1d4d89d2c3a83afd99ffee8b3a2f69 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 25 Sep 2014 11:22:40 +0200 Subject: [PATCH] Bug 12973: Additional unit tests for XSLT_Handler.t Content-Type: text/plain; charset=utf-8 The additional way of parameter passing is tested in three additional tests. Test plan: Verify if XSLT_Handler.t passes. --- t/db_dependent/XSLT_Handler.t | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/XSLT_Handler.t b/t/db_dependent/XSLT_Handler.t index 8bdfdef..770568c 100644 --- a/t/db_dependent/XSLT_Handler.t +++ b/t/db_dependent/XSLT_Handler.t @@ -20,7 +20,8 @@ use Modern::Perl; use FindBin; -use Test::More tests => 24; +use File::Slurp; +use Test::More tests => 27; use Koha::XSLT_Handler; @@ -96,6 +97,16 @@ $output= $engine->transform( $xml_2 ); #note: second parameter (file) not passed again is( $engine->err, undef, 'Engine returned no error for xml_2' ); is( index($output,'I saw you')>0, 1, 'Saw the expected change for xml_2' ); #Just very simple check if new datafield was added +#Test alternative parameter passing +my $output2; +$output2 = $engine->transform( { file => $xsltfile_1, xml => $xml_2 } ); +is( $output, $output2, 'Try hash parameter file'); +my $code = read_file( $xsltfile_1 ); +$output2 = $engine->transform( { code => $code, xml => $xml_2 } ); +is( $output, $output2, 'Try hash parameter code'); +#Check rerun on last code +$output2 = $engine->transform( $xml_2 ); +is( $output, $output2, 'Rerun on previous passed code'); #The second test xsl contains bad code my $xsltfile_2 = 'test02.xsl'; @@ -114,6 +125,6 @@ exit if !-e $path.$xsltfile_3; $xsltfile_3= $path.$xsltfile_3; $output= $engine->transform( $xml_2, $xsltfile_3 ); is( $engine->err, undef, 'Unexpected error on transform with third xsl' ); -is( $engine->refresh, 2, 'Final test on clearing cache' ); +is( $engine->refresh, 3, 'Final test on clearing cache' ); #End of tests -- 1.7.7.6