From 1f6dd292cdab8c69e02728684ed2990626baa955 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 1 Feb 2016 18:26:41 -0500 Subject: [PATCH] Bug 15719: Silence warning in C4/Language.pm during web install - tests Test empty database case. TEST PLAN --------- 1) prove -v t/Languages.t -- success (because test case is missing) 2) Apply this patch 3) prove -v t/Languages.t -- success, but warning printed. 4) run koha qa test tools Signed-off-by: Hector Castro Works as advertised. QA test tools rus OK Signed-off-by: Jonathan Druart --- t/Languages.t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/Languages.t b/t/Languages.t index 6b0f638..8fee200 100644 --- a/t/Languages.t +++ b/t/Languages.t @@ -18,7 +18,7 @@ # with Koha; if not, see . use Modern::Perl; -use Test::More tests => 3; +use Test::More tests => 4; use Test::MockModule; use CGI qw ( -utf8 ); @@ -28,13 +28,16 @@ BEGIN { my @languages = (); # stores the list of active languages # for the syspref mock +my $return_undef = 0; my $module_context = new Test::MockModule('C4::Context'); $module_context->mock( preference => sub { my ($self, $pref) = @_; - if ($pref =~ /language/) { + if ($return_undef) { + return undef; + } elsif ($pref =~ /language/) { return join ',', @languages; } else { return 'XXX'; @@ -50,3 +53,6 @@ is(C4::Languages::getlanguage($query), 'de-DE', 'default to first language speci @languages = (); is(C4::Languages::getlanguage($query), 'en', 'default to English if no language specified in syspref (bug 10560)'); + +$return_undef = 1; +is(C4::Languages::getlanguage($query), 'en', 'default to English if no database'); -- 2.1.0