Bug 30287: (follow-up) Make unit test more reliable in ktd

This patch mocks NoticeCSS earlier to ensure we're not inadvertantly
failing due to a local setup in ktd having added to the preference.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 12e90c8b7d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Martin Renvoize 2023-11-11 11:06:32 +00:00 committed by Fridolin Somers
parent f89d178b06
commit 52772da921

View file

@ -72,6 +72,8 @@ subtest 'html_content() tests' => sub {
}
);
t::lib::Mocks::mock_preference( 'NoticeCSS', '' );
my $css_import = '';
my $message = Koha::Notice::Messages->find($message_id);
my $wrapped_compare = <<"WRAPPED";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@ -80,7 +82,7 @@ subtest 'html_content() tests' => sub {
<head>
<title>$firstname</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
$css_import
</head>
<body>
This is a test template using borrower $borrowernumber
@ -92,6 +94,7 @@ WRAPPED
my $css_sheet = 'https://localhost/shiny.css';
t::lib::Mocks::mock_preference( 'NoticeCSS', $css_sheet );
$css_import = qq{<link rel="stylesheet" type="text/css" href="$css_sheet">};
$wrapped_compare = <<"WRAPPED";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@ -100,7 +103,7 @@ WRAPPED
<head>
<title>$firstname</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="$css_sheet">
$css_import
</head>
<body>
This is a test template using borrower $borrowernumber