From d3d27b0dd65a1c6353c5dacbba923896fa9ee4e1 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 14 May 2014 23:38:12 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 7841 - Tests to detect no changes When called with undef, floody messages appear in the error logs. Less floody messages appear when using 'en' as the language. TEST PLAN --------- 1) apply the patch 2) prove -v t/db_dependent/Languages.t -- All the tests should pass, including the last two which a) check that when undef is used no language is marked as current. b) check that when 'en' is used there is a language marked as current. Signed-off-by: Bernardo Gonzalez Kriegel Test pass, no koha-qa errors --- t/db_dependent/Languages.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Languages.t b/t/db_dependent/Languages.t index b3c82bc..474987f 100755 --- a/t/db_dependent/Languages.t +++ b/t/db_dependent/Languages.t @@ -6,7 +6,9 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 11; +use List::Util qw(first); +use Data::Dumper; BEGIN { use_ok('C4::Languages'); @@ -38,4 +40,14 @@ C4::Context->set_preference('AdvancedSearchLanguages', 'ita|eng'); $languages = C4::Languages::getLanguages('eng', 1); is(scalar(@$languages), 2, 'getLanguages() filtering using AdvancedSearchLanguages works'); +my $translatedlanguages1 = C4::Languages::getTranslatedLanguages('opac','prog',undef,''); +my @currentcheck1 = map { $_->{current} } @$translatedlanguages1; +my $onlyzeros = first { $_ != 0 } @currentcheck1; +ok(! $onlyzeros, "Everything was zeros.\n"); + +my $translatedlanguages2 = C4::Languages::getTranslatedLanguages('opac','prog','en',''); +my @currentcheck2 = map { $_->{current} } @$translatedlanguages2; +$onlyzeros = first { $_ != 0 } @currentcheck2; +ok($onlyzeros, "There is a $onlyzeros\n"); + $dbh->rollback; -- 1.7.9.5