$SIG{__DIE__} = sub { Carp::confess( @_ ) } if $::lx_office_conf{debug}->{backtrace_on_die};
+ Support::TestSetup::create_form_template_provider();
+
return 1;
}
-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;
+sub create_form_template_provider {
+ $::form->template(Template->new(template_config())) || die;
+}
- return 1;
+sub template_config {
+ return {
+ INTERPOLATE => 0,
+ EVAL_PERL => 0,
+ ABSOLUTE => 1,
+ CACHE_SIZE => 0,
+ PLUGIN_BASE => 'SL::Template::Plugin',
+ INCLUDE_PATH => '.:templates/webpages/',
+ COMPILE_DIR => 'users/templates-cache-for-tests',
+ COMPILE_EXT => '.tcc',
+ ENCODING => 'utf8',
+ };
}
1;
use strict;
use Test::Exception;
-use Test::More;
+use Test::More tests => 19;
use Test::Output;
use lib 't';
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';
use strict;
use Test::Exception;
-use Test::More;
+use Test::More tests => 11;
use lib 't';
use Support::TestSetup;
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:
use lib 't';
use Support::Templates;
+use Support::TestSetup;
use File::Spec;
use File::Slurp;
my $template_path = 'templates/webpages/';
-my $provider = Template::Provider->new({
- INTERPOLATE => 0,
- EVAL_PERL => 0,
- ABSOLUTE => 1,
- CACHE_SIZE => 0,
- PLUGIN_BASE => 'SL::Template::Plugin',
- INCLUDE_PATH => '.:' . $template_path,
- COMPILE_DIR => 'users/templates-cache-for-tests',
-});
+my $provider = Template::Provider->new(Support::TestSetup::template_config());
foreach my $ref (@Support::Templates::referenced_files) {
my $file = "${template_path}${ref}.html";