|
Lines 19-29
use Modern::Perl;
Link Here
|
| 19 |
|
19 |
|
| 20 |
use CGI; |
20 |
use CGI; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 5; |
22 |
use Test::More tests => 6; |
| 23 |
use Test::Deep; |
23 |
use Test::Deep; |
| 24 |
use Test::MockModule; |
24 |
use Test::MockModule; |
| 25 |
use Test::Warn; |
25 |
use Test::Warn; |
| 26 |
use File::Temp qw/tempfile/; |
26 |
use File::Temp qw/tempfile/; |
|
|
27 |
use URI::Escape; |
| 27 |
|
28 |
|
| 28 |
use t::lib::Mocks; |
29 |
use t::lib::Mocks; |
| 29 |
|
30 |
|
|
Lines 139-141
subtest "Absolute path change in _get_template_file" => sub {
Link Here
|
| 139 |
$template->param( quality => 'good-for-nothing' ); |
140 |
$template->param( quality => 'good-for-nothing' ); |
| 140 |
like( $template->output, qr/a good.+template.+doubt/, 'Testing a template with an absolute path' ); |
141 |
like( $template->output, qr/a good.+template.+doubt/, 'Testing a template with an absolute path' ); |
| 141 |
}; |
142 |
}; |
| 142 |
- |
143 |
|
|
|
144 |
subtest "Template::Toolkit uses RFC3986" => sub { |
| 145 |
plan tests => 1; |
| 146 |
|
| 147 |
my $s = q{console.log("alert('boo!')");}; |
| 148 |
my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1, DIR => C4::Context::temporary_directory ); |
| 149 |
print $fh q{URI=[% filter_me | uri %], URL=[% filter_me | url %]}; |
| 150 |
close $fh; |
| 151 |
my ( $template, $login, $cookie ) = C4::Auth::get_template_and_user( |
| 152 |
{ |
| 153 |
template_name => $fn, |
| 154 |
query => CGI::new, |
| 155 |
type => "opac", |
| 156 |
authnotrequired => 1, |
| 157 |
} |
| 158 |
); |
| 159 |
$template->param( filter_me => $s ); |
| 160 |
my $filtered_s = uri_escape $s; |
| 161 |
is( |
| 162 |
$template->output, sprintf( q{URI=%s, URL=%s}, $filtered_s, $filtered_s ), |
| 163 |
'Testing a template with an absolute path' |
| 164 |
); |
| 165 |
}; |