|
Lines 46-52
subtest '_create_connection' => sub {
Link Here
|
| 46 |
}; |
46 |
}; |
| 47 |
#Group 3: testing _do_xslt_proc (part of Z3950Search) |
47 |
#Group 3: testing _do_xslt_proc (part of Z3950Search) |
| 48 |
subtest '_do_xslt_proc' => sub { |
48 |
subtest '_do_xslt_proc' => sub { |
| 49 |
plan tests => 7; |
49 |
plan tests => 6; |
| 50 |
test_do_xslt(); |
50 |
test_do_xslt(); |
| 51 |
}; |
51 |
}; |
| 52 |
|
52 |
|
|
Lines 162-188
sub test_do_xslt {
Link Here
|
| 162 |
|
162 |
|
| 163 |
#ready for the main test |
163 |
#ready for the main test |
| 164 |
my @res = C4::Breeding::_do_xslt_proc( $biblio, $server, $engine ); |
164 |
my @res = C4::Breeding::_do_xslt_proc( $biblio, $server, $engine ); |
| 165 |
is( $res[1] && $res[1] eq 'xslt_err', undef, |
165 |
is( $res[1], undef, 'No error returned' ); |
| 166 |
'Check error code of _do_xslt_proc'); |
166 |
is( ref $res[0], 'MARC::Record', 'Got back MARC record'); |
| 167 |
if( !$res[1] ) { |
167 |
is( $res[0]->subfield('990','a'), 'I saw you', 'Found 990a in the record'); |
| 168 |
is( ref $res[0] eq 'MARC::Record', 1, 'Got back MARC record'); |
|
|
| 169 |
my $sub = $res[0]->subfield('990','a')//''; |
| 170 |
is( $sub eq 'I saw you', 1, 'Found 990a in the record'); |
| 171 |
} else { |
| 172 |
ok( 1, 'Skipped one test'); |
| 173 |
ok( 1, 'Skipped another one'); |
| 174 |
} |
| 175 |
|
168 |
|
| 176 |
#forcing an error on the xslt side |
169 |
#forcing an error on the xslt side |
| 177 |
$server->{add_xslt} = 'notafile.xsl'; |
170 |
$server->{add_xslt} = 'notafile.xsl'; |
| 178 |
warning_like |
171 |
@res = C4::Breeding::_do_xslt_proc( $biblio, $server, $engine ); |
| 179 |
{ @res = C4::Breeding::_do_xslt_proc( $biblio, $server, $engine ) } |
172 |
is( $res[1], Koha::XSLT_Handler::XSLTH_ERR_2, 'Error code found' ); |
| 180 |
qr/^XSLT file not found./, |
|
|
| 181 |
'_do_xslt_proc warns it XSLT_handler problem'; |
| 182 |
is( $res[1] && $res[1] eq 'xslt_err', 1, |
| 183 |
'Check error code again'); |
| 184 |
#We still expect the original record back |
173 |
#We still expect the original record back |
| 185 |
is( ref $res[0] eq 'MARC::Record', 1, 'Still got back MARC record'); |
174 |
is( ref $res[0], 'MARC::Record', 'Still got back MARC record' ); |
| 186 |
is ( $res[0]->subfield('245','a') eq 'Just a title', 1, |
175 |
is ( $res[0]->subfield('245','a'), 'Just a title', |
| 187 |
'At least the title is the same :)' ); |
176 |
'At least the title is the same :)' ); |
| 188 |
} |
177 |
} |
| 189 |
- |
|
|