View | Details | Raw Unified | Return to bug 33030
Collapse All | Expand All

(-)a/t/Template/Utils.t (-1 / +60 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) 2023 ByWater Solutions
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
use Test::More tests => 3;
22
23
use utf8;
24
25
use_ok('Koha::TemplateUtils');
26
27
subtest 'Process arbitrary var' => sub {
28
    plan tests => 2;
29
30
    is(
31
        Koha::TemplateUtils::process_tt(
32
            "This is a test.",
33
            { test => 'simple test' }
34
        ),
35
        "This is a test.",
36
        "Processing template toolkit with no TT markup works"
37
    );
38
39
    is(
40
        Koha::TemplateUtils::process_tt(
41
            "This is a [% test %].",
42
            { test => 'simple test' }
43
        ),
44
        "This is a simple test.",
45
        "Processing template toolkit with a var works"
46
    );
47
};
48
49
subtest 'Plugin related tests' => sub {
50
    plan tests => 1;
51
52
    is(
53
        Koha::TemplateUtils::process_tt(
54
            q{[% USE raw %]This is a [% test | $raw %].},
55
            { test => 'simple test' }
56
        ),
57
        "This is a simple test.",
58
        "Processing template tookit with a Koha plugin works"
59
    );
60
};

Return to bug 33030