|
Lines 21-26
use Modern::Perl;
Link Here
|
| 21 |
|
21 |
|
| 22 |
use FindBin; |
22 |
use FindBin; |
| 23 |
use Test::More tests => 3; |
23 |
use Test::More tests => 3; |
|
|
24 |
use Test::Warn; |
| 24 |
|
25 |
|
| 25 |
use C4::Breeding; |
26 |
use C4::Breeding; |
| 26 |
use Koha::XSLT_Handler; |
27 |
use Koha::XSLT_Handler; |
|
Lines 45-51
subtest '_create_connection' => sub {
Link Here
|
| 45 |
}; |
46 |
}; |
| 46 |
#Group 3: testing _do_xslt_proc (part of Z3950Search) |
47 |
#Group 3: testing _do_xslt_proc (part of Z3950Search) |
| 47 |
subtest '_do_xslt_proc' => sub { |
48 |
subtest '_do_xslt_proc' => sub { |
| 48 |
plan tests => 6; |
49 |
plan tests => 7; |
| 49 |
test_do_xslt(); |
50 |
test_do_xslt(); |
| 50 |
}; |
51 |
}; |
| 51 |
|
52 |
|
|
Lines 89-97
sub test_build_translate_query {
Link Here
|
| 89 |
is( @matches == 2, 1, 'Second Z39.50 query includes two @attr 1='); |
90 |
is( @matches == 2, 1, 'Second Z39.50 query includes two @attr 1='); |
| 90 |
#We should find text of both parameters in the query |
91 |
#We should find text of both parameters in the query |
| 91 |
$str= $pars2->{isbn}; |
92 |
$str= $pars2->{isbn}; |
| 92 |
is( $queries[0] =~ /$str/, 1, 'Second query contains ISBN'); |
93 |
is( $queries[0] =~ /\"$str\"/, 1, |
|
|
94 |
'Second query contains ISBN enclosed by double quotes'); |
| 93 |
$str= $pars2->{title}; |
95 |
$str= $pars2->{title}; |
| 94 |
is( $queries[0] =~ /$str/, 1, 'Second query contains title'); |
96 |
is( $queries[0] =~ /\"$str\"/, 1, |
|
|
97 |
'Second query contains title enclosed by double quotes'); |
| 98 |
|
| 95 |
#SRU revisited |
99 |
#SRU revisited |
| 96 |
$server= { sru_fields => 'isbn=nb,title=dc.title,srchany=overal' }; |
100 |
$server= { sru_fields => 'isbn=nb,title=dc.title,srchany=overal' }; |
| 97 |
$squery= C4::Breeding::_translate_query( $server, $queries[1] ); |
101 |
$squery= C4::Breeding::_translate_query( $server, $queries[1] ); |
|
Lines 171-177
sub test_do_xslt {
Link Here
|
| 171 |
|
175 |
|
| 172 |
#forcing an error on the xslt side |
176 |
#forcing an error on the xslt side |
| 173 |
$server->{add_xslt} = 'notafile.xsl'; |
177 |
$server->{add_xslt} = 'notafile.xsl'; |
| 174 |
@res = C4::Breeding::_do_xslt_proc( $biblio, $server, $engine ); |
178 |
warning_like |
|
|
179 |
{ @res = C4::Breeding::_do_xslt_proc( $biblio, $server, $engine ) } |
| 180 |
qr/^XSLT file not found./, |
| 181 |
'_do_xslt_proc warns it XSLT_handler problem'; |
| 175 |
is( $res[1] && $res[1] eq 'xslt_err', 1, |
182 |
is( $res[1] && $res[1] eq 'xslt_err', 1, |
| 176 |
'Check error code again'); |
183 |
'Check error code again'); |
| 177 |
#We still expect the original record back |
184 |
#We still expect the original record back |
| 178 |
- |
|
|