Bug 11749 - Remove unused jQuery plugin jquery.hoverIntent.minified.js from the staff...
[koha.git] / t / Templates.t
blob9343b3806e49f45978148b7e8fd88d0f103fcd8c
1 #!/usr/bin/perl
3 # Copyright 2013 Equinox Software, Inc.
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, see <http://www.gnu.org/licenses>.
19 use Modern::Perl;
20 use Test::More tests => 3;
21 use Test::MockModule;
22 use CGI;
24 BEGIN {
25 use_ok('C4::Templates');
28 my @languages = (); # stores the list of active languages
29 # for the syspref mock
31 my $module_context = new Test::MockModule('C4::Context');
33 $module_context->mock(
34 preference => sub {
35 my ($self, $pref) = @_;
36 if ($pref =~ /language/) {
37 return join ',', @languages;
38 } else {
39 return 'XXX';
44 delete $ENV{TTTP_ACCEPT_LANGUAGE};
46 my $query = CGI->new();
47 @languages = ('de-DE', 'fr-FR');
48 is(C4::Templates::getlanguage($query, 'opac'), 'de-DE', 'default to first language specified in syspref (bug 10560)');
50 @languages = ();
51 is(C4::Templates::getlanguage($query, 'opac'), 'en', 'default to English if no language specified in syspref (bug 10560)');