From 3d235ebc959afddf0b6bac75a2ca3a407cb3b747 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 13 Mar 2026 10:43:14 +0100 Subject: [PATCH] Bug 38365: Do not rely on KOHA_HOME in tests We never do that in our tests, and KOHA_HOME is not defined for the kohadev-koha user in ktd. Signed-off-by: Jonathan Druart --- t/db_dependent/Koha/Middleware/ContentSecurityPolicy.t | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Koha/Middleware/ContentSecurityPolicy.t b/t/db_dependent/Koha/Middleware/ContentSecurityPolicy.t index 5b3b7a40e92..bc32a58a964 100755 --- a/t/db_dependent/Koha/Middleware/ContentSecurityPolicy.t +++ b/t/db_dependent/Koha/Middleware/ContentSecurityPolicy.t @@ -26,6 +26,7 @@ use HTTP::Request::Common; use Plack::App::CGIBin; use Plack::Builder; use Plack::Test; +use File::Basename; use Koha::Database; @@ -116,7 +117,7 @@ subtest 'test CSP in OPAC' => sub { ); my $env = {}; - my $home = $ENV{KOHA_HOME}; + my $home = dirname(__FILE__) . '/../../../..'; my $app = Plack::App::CGIBin->new( root => $ENV{GIT_INSTALL} ? "$home/opac" : "$home/opac/cgi-bin/opac" )->to_app; $app = builder { @@ -175,7 +176,7 @@ subtest 'test CSP in staff client' => sub { ); my $env = {}; - my $home = $ENV{KOHA_HOME}; + my $home = dirname(__FILE__) . '/../../../..'; my $app = Plack::App::CGIBin->new( root => $ENV{GIT_INSTALL} ? $home : "$home/intranet/cgi-bin/" )->to_app; $app = builder { @@ -250,7 +251,7 @@ subtest 'test Reporting-Endpoints for CSP violation reports' => sub { Koha::ContentSecurityPolicy->new->set_nonce($test_nonce); my $env = {}; - my $home = $ENV{KOHA_HOME}; + my $home = dirname(__FILE__) . '/../../../..'; my $app = Plack::App::CGIBin->new( root => $ENV{GIT_INSTALL} ? "$home/opac" : "$home/opac/cgi-bin/opac" )->to_app; $app = builder { -- 2.43.0