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

(-)a/t/Languages.t (-3 / +8 lines)
Lines 18-24 Link Here
18
# with Koha; if not, see <http://www.gnu.org/licenses>.
18
# with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 3;
21
use Test::More tests => 4;
22
use Test::MockModule;
22
use Test::MockModule;
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
24
Lines 28-40 BEGIN { Link Here
28
28
29
my @languages = (); # stores the list of active languages
29
my @languages = (); # stores the list of active languages
30
                    # for the syspref mock
30
                    # for the syspref mock
31
my $return_undef = 0;
31
32
32
my $module_context = new Test::MockModule('C4::Context');
33
my $module_context = new Test::MockModule('C4::Context');
33
34
34
$module_context->mock(
35
$module_context->mock(
35
    preference => sub {
36
    preference => sub {
36
        my ($self, $pref) = @_;
37
        my ($self, $pref) = @_;
37
        if ($pref =~ /language/) {
38
        if ($return_undef) {
39
            return undef;
40
        } elsif ($pref =~ /language/) {
38
            return join ',', @languages;
41
            return join ',', @languages;
39
        } else {
42
        } else {
40
            return 'XXX';
43
            return 'XXX';
Lines 50-52 is(C4::Languages::getlanguage($query), 'de-DE', 'default to first language speci Link Here
50
53
51
@languages = ();
54
@languages = ();
52
is(C4::Languages::getlanguage($query), 'en', 'default to English if no language specified in syspref (bug 10560)');
55
is(C4::Languages::getlanguage($query), 'en', 'default to English if no language specified in syspref (bug 10560)');
53
- 
56
57
$return_undef = 1;
58
is(C4::Languages::getlanguage($query), 'en', 'default to English if no database');

Return to bug 15719