From de2a3fff6755641917afd9679c91e3c46823afeb Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 23 Oct 2017 18:57:55 +0000 Subject: [PATCH] Bug 19512: silence noise when KOHA_PATH undefined. If you run the tests with KOHA_PATH unset, this bombs. Apply the patch, and it copes by guessing the current directory. Signed-off-by: Mark Tompsett --- t/Koha/Exceptions/File.t | 5 +++-- t/Koha/File.t | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/t/Koha/Exceptions/File.t b/t/Koha/Exceptions/File.t index ddca7f0..79e99b5 100644 --- a/t/Koha/Exceptions/File.t +++ b/t/Koha/Exceptions/File.t @@ -9,7 +9,8 @@ use Koha::Exceptions::File; #file diagnostics are more throughly tested in t/Koha/File.t subtest "Catch File-exception and inspect diagnostics", \&getDiagnostics; sub getDiagnostics { - my $file = $ENV{KOHA_PATH}.'/kohaversion.pl'; + my $koha_path= $ENV{KOHA_PATH} // q{.}; + my $file = $koha_path . '/kohaversion.pl'; my $parentDir = File::Basename::dirname($file); try { Koha::Exceptions::File->throw(error => "error", path => $file); @@ -19,7 +20,7 @@ sub getDiagnostics { like($e->stat, qr/^\w+/, "Then the file diagnostics look legit"); }; - $file = $ENV{KOHA_PATH}.'/koha-aversion.pl'; + $file = $koha_path . '/koha-aversion.pl'; try { Koha::Exceptions::File->throw(error => "error", path => $file); ok(0, "??Why no throw exception??"); diff --git a/t/Koha/File.t b/t/Koha/File.t index 8ad2a71..76e03a2 100644 --- a/t/Koha/File.t +++ b/t/Koha/File.t @@ -5,8 +5,9 @@ use Koha::File; subtest "Test file diagnostic", \&getDiagnostics; sub getDiagnostics { - _testDiagnostics($ENV{KOHA_PATH}.'/kohaversion.pl', '-'); - _testDiagnostics($ENV{KOHA_PATH}.'/xt', 'd'); + my $koha_path = $ENV{KOHA_PATH} // q{.}; + _testDiagnostics($koha_path . '/kohaversion.pl', '-'); + _testDiagnostics($koha_path . '/xt', 'd'); } -- 2.1.4