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
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>.
20 use Test
::More tests
=> 3;
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(
35 my ($self, $pref) = @_;
36 if ($pref =~ /language/) {
37 return join ',', @languages;
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)');
51 is
(C4
::Templates
::getlanguage
($query, 'opac'), 'en', 'default to English if no language specified in syspref (bug 10560)');