Bug 13422 - SCO: "Would you like to print a receipt" not translatable
[koha.git] / t / Languages.t
blob9cafbd77bd1eb6441f8f7a0e25a45828e16858f3
1 #!/usr/bin/perl
3 # Copyright 2013 Equinox Software, Inc.
4 # Copyright 2014 BibLibre
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 3 of the License, or (at your option) any later
11 # version.
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Modern::Perl;
21 use Test::More tests => 3;
22 use Test::MockModule;
23 use CGI;
25 BEGIN {
26 use_ok('C4::Languages');
29 my @languages = (); # stores the list of active languages
30 # for the syspref mock
32 my $module_context = new Test::MockModule('C4::Context');
34 $module_context->mock(
35 preference => sub {
36 my ($self, $pref) = @_;
37 if ($pref =~ /language/) {
38 return join ',', @languages;
39 } else {
40 return 'XXX';
45 delete $ENV{HTTP_ACCEPT_LANGUAGE};
47 my $query = CGI->new();
48 @languages = ('de-DE', 'fr-FR');
49 is(C4::Languages::getlanguage($query), 'de-DE', 'default to first language specified in syspref (bug 10560)');
51 @languages = ();
52 is(C4::Languages::getlanguage($query), 'en', 'default to English if no language specified in syspref (bug 10560)');