From 8e4d0525ef72c01dd6d7b130af88acaa43c2b265 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 28 Feb 2020 08:20:43 +0000 Subject: [PATCH] Bug 24756: Fix D8 and U18 failures for Koha/XSLT/Security.t Content-Type: text/plain; charset=utf-8 Instead of warning_like, we eventually catch multiple warnings and look if we catch one specific warn and not catch another specific one. Test plan: Run t/db_dependent/Koha/XSLT/Security.t on D8, D9, D10 or U18. Signed-off-by: Marcel de Rooy Passes on D8 and D9 for me. --- 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 67a27ade3e..41b72aafb5 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::Base; @@ -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/ } @warn ), 1, 'Expected import error' ); + is( ( grep { /read_net/ } @warn ), 0, 'No read_net warn for remote import' ); +} sub mytempfile { my ( $fh, $fn ) = tempfile( SUFFIX => '.xsl', UNLINK => 1 ); -- 2.11.0