Bug 25728: Don't explode if no CAN_* var defined
[koha.git] / t / TmplToken.t
blob579ee9d591f122f82e590fb23e4f56c28ec3924a
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use strict;
7 use warnings;
8 use C4::TmplTokenType;
9 use Test::More tests => 19;
11 BEGIN {
12 use_ok('C4::TmplToken');
15 ok (my $token = C4::TmplToken->new('test',C4::TmplTokenType::TEXT,10,'/tmp/translate.txt'), "Create new");
16 ok ($token->string eq 'test', "String works");
17 ok ($token->type == C4::TmplTokenType::TEXT, "Token works");
18 ok ($token->line_number == 10, "Line number works");
19 ok ($token->pathname eq '/tmp/translate.txt', "Path works");
22 ok ($token->text_p, "text_p works");
24 is($token-> children(), undef, "testing children returns undef when given argument");
26 ok($token-> set_children(), "testing set_children with no arguments");
28 is($token-> parameters_and_fields(), "0", "testing Parameters and fields returns 0 when given argument");
30 is($token-> anchors(), "0", "testing anchors returns 0 when given argument");
32 is($token-> form(),undef, "testing form returns undef when given argument");
34 ok($token-> set_form(), "testing set_form with no arguments");
36 is($token-> js_data(),undef, "testing form returns undef when given argument");
38 ok($token-> set_js_data(), "testing set_js_data with no arguments");
40 is($token-> tag_p(),"", "testing tag_p returns '' when given argument");
42 is($token-> cdata_p(),"", "testing cdata_p returns '' when given argument");
44 is($token-> text_parametrized_p(),"", "testing text_parametrized returns '' when given argument");
46 is($token-> directive_p(),"", "testing directive_p returns '' when given argument");