From 5418efe4824d4ec11e44fc40bda35294190ab0c7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 2 Mar 2020 11:08:18 +0000 Subject: [PATCH] Bug 24756: [19.11.X] Catch two failed to load-variations in Security.t Test 7 in Security.t failed when 'failed to load HTTP resource' was returned by libxml2 instead of 'failed to load external entity'. We now remove the debugging with Dumper again and adjust the regex to include both variations. Signed-off-by: Marcel de Rooy Signed-off-by: Joy Nelson (cherry picked from commit 09b8c38a8264c55ae5e7187cb76e608a072729fd) Signed-off-by: Lucas Gass --- t/db_dependent/Koha/XSLT/Security.t | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Koha/XSLT/Security.t b/t/db_dependent/Koha/XSLT/Security.t index 249d549afc..3bd1181eb7 100644 --- a/t/db_dependent/Koha/XSLT/Security.t +++ b/t/db_dependent/Koha/XSLT/Security.t @@ -19,7 +19,7 @@ use Modern::Perl; use File::Temp qw/tempfile/; -use Test::More tests => 7; +use Test::More tests => 8; use Test::Warn; use Koha::XSLT_Handler; @@ -120,9 +120,13 @@ $xslt=<<"EOT"; EOT $xslt_file = mytempfile($xslt); $engine->print_warns(1); -warning_like { $output= $engine->transform( "", $xslt_file ); } - qr/I\/O warning : failed to load external entity/, - 'Remote import does not fail on read_net'; +{ + my @warn; + local $SIG{__WARN__} = sub { push @warn, $_[0]; }; + $output= $engine->transform( "", $xslt_file ); + is( ( grep { /failed to load (external entity|HTTP resource)/ } @warn ), 1, 'Expected import error' ); # we saw both messages on Jenkins passing by + is( ( grep { /read_net/ } @warn ), 0, 'No read_net warn for remote import' ); +} sub mytempfile { my ( $fh, $fn ) = tempfile( SUFFIX => '.xsl', UNLINK => 1 ); -- 2.20.1