|
Lines 20-26
Link Here
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use FindBin; |
22 |
use FindBin; |
| 23 |
use Test::More tests => 24; |
23 |
use File::Slurp; |
|
|
24 |
use Test::More tests => 27; |
| 24 |
|
25 |
|
| 25 |
use Koha::XSLT_Handler; |
26 |
use Koha::XSLT_Handler; |
| 26 |
|
27 |
|
|
Lines 96-101
$output= $engine->transform( $xml_2 );
Link Here
|
| 96 |
#note: second parameter (file) not passed again |
97 |
#note: second parameter (file) not passed again |
| 97 |
is( $engine->err, undef, 'Engine returned no error for xml_2' ); |
98 |
is( $engine->err, undef, 'Engine returned no error for xml_2' ); |
| 98 |
is( index($output,'I saw you')>0, 1, 'Saw the expected change for xml_2' ); #Just very simple check if new datafield was added |
99 |
is( index($output,'I saw you')>0, 1, 'Saw the expected change for xml_2' ); #Just very simple check if new datafield was added |
|
|
100 |
#Test alternative parameter passing |
| 101 |
my $output2; |
| 102 |
$output2 = $engine->transform( { file => $xsltfile_1, xml => $xml_2 } ); |
| 103 |
is( $output, $output2, 'Try hash parameter file'); |
| 104 |
my $code = read_file( $xsltfile_1 ); |
| 105 |
$output2 = $engine->transform( { code => $code, xml => $xml_2 } ); |
| 106 |
is( $output, $output2, 'Try hash parameter code'); |
| 107 |
#Check rerun on last code |
| 108 |
$output2 = $engine->transform( $xml_2 ); |
| 109 |
is( $output, $output2, 'Rerun on previous passed code'); |
| 99 |
|
110 |
|
| 100 |
#The second test xsl contains bad code |
111 |
#The second test xsl contains bad code |
| 101 |
my $xsltfile_2 = 'test02.xsl'; |
112 |
my $xsltfile_2 = 'test02.xsl'; |
|
Lines 114-119
exit if !-e $path.$xsltfile_3;
Link Here
|
| 114 |
$xsltfile_3= $path.$xsltfile_3; |
125 |
$xsltfile_3= $path.$xsltfile_3; |
| 115 |
$output= $engine->transform( $xml_2, $xsltfile_3 ); |
126 |
$output= $engine->transform( $xml_2, $xsltfile_3 ); |
| 116 |
is( $engine->err, undef, 'Unexpected error on transform with third xsl' ); |
127 |
is( $engine->err, undef, 'Unexpected error on transform with third xsl' ); |
| 117 |
is( $engine->refresh, 2, 'Final test on clearing cache' ); |
128 |
is( $engine->refresh, 3, 'Final test on clearing cache' ); |
| 118 |
|
129 |
|
| 119 |
#End of tests |
130 |
#End of tests |
| 120 |
- |
|
|