From: Moritz Bunkus Date: Tue, 2 Jul 2013 08:17:29 +0000 (+0200) Subject: Tests: Tests skippen, wenn Template-Cache-Verzeichnis nicht schreibbar ist X-Git-Tag: release-3.1.0beta1~235 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a67ad20f388cd35487a7a9d46a003e39e1f402aa;p=kivitendo-erp.git Tests: Tests skippen, wenn Template-Cache-Verzeichnis nicht schreibbar ist --- diff --git a/t/Support/TestSetup.pm b/t/Support/TestSetup.pm index 2fbbd2d5f..081e7b106 100644 --- a/t/Support/TestSetup.pm +++ b/t/Support/TestSetup.pm @@ -4,6 +4,7 @@ use strict; use Data::Dumper; use CGI qw( -no_xhtml); +use IO::File; use SL::Auth; use SL::Form; use SL::Locale; @@ -56,4 +57,19 @@ sub login { _login($client, $login); } +sub templates_cache_writable { + my $dir = $::lx_office_conf{paths}->{userspath} . '/templates-cache'; + return 1 if -w $dir; + + # Try actually creating a file. Due to ACLs this might be possible + # even if the basic Unix permissions and Perl's -w test say + # otherwise. + my $file = "${dir}/.writetest"; + my $out = IO::File->new($file, "w") || return 0; + $out->close; + unlink $file; + + return 1; +} + 1; diff --git a/t/controllers/base/render.t b/t/controllers/base/render.t index 0a15078e0..3d5bad0e5 100644 --- a/t/controllers/base/render.t +++ b/t/controllers/base/render.t @@ -14,6 +14,12 @@ no warnings 'uninitialized'; Support::TestSetup::login(); +if (!Support::TestSetup::templates_cache_writable()) { + plan skip_all => 'Cache dir not writable for this test'; +} else { + plan tests => 19; +} + sub reset_test_env { $ENV{HTTP_USER_AGENT} = 'Perl Tests'; diff --git a/t/presenter/base/render.t b/t/presenter/base/render.t index 5d7c96ea3..4e389f9b0 100644 --- a/t/presenter/base/render.t +++ b/t/presenter/base/render.t @@ -9,6 +9,12 @@ use SL::Presenter; Support::TestSetup::login(); +if (!Support::TestSetup::templates_cache_writable()) { + plan skip_all => 'Cache dir not writable for this test'; +} else { + plan tests => 11; +} + my $pr = SL::Presenter->get; # Passing invalid parameters: