From 1fafa4017d38437178ac13f4a5c27c26a7f46dc5 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Tue, 27 Jun 2017 12:33:29 +0200
Subject: [PATCH] Fix test on currency name

---
 htdocs/core/lib/company.lib.php | 2 ++
 test/phpunit/CompanyLibTest.php | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index d1e0b9020b7..c0e5e896872 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -434,6 +434,8 @@ function currency_name($code_iso, $withcode='', $outputlangs=null)
 
     if (empty($outputlangs)) $outputlangs=$langs;
 
+    $outputlangs->load("dict");
+
     // If there is a translation, we can send immediatly the label
     if ($outputlangs->trans("Currency".$code_iso)!="Currency".$code_iso)
     {
diff --git a/test/phpunit/CompanyLibTest.php b/test/phpunit/CompanyLibTest.php
index f4aebc11026..330eb914308 100644
--- a/test/phpunit/CompanyLibTest.php
+++ b/test/phpunit/CompanyLibTest.php
@@ -129,11 +129,10 @@ class CompanyLibTest extends PHPUnit_Framework_TestCase
 
         $result=currency_name('USD');
         print __METHOD__." result=".$result."\n";
-        $this->assertEquals('United States Dollar',$result,'Test to get currency name USD in default language '.$langs->defaultlang);
+        $this->assertEquals('US Dollars',$result,'Test to get currency name USD in default language '.$langs->defaultlang);
 
         $outputlangs=new Translate('', $conf);
         $outputlangs->setDefaultLang('fr_FR');
-        $outputlangs->load("dict");
 
         $result=currency_name('USD', 1, $outputlangs);
         print __METHOD__." result=".$result."\n";
-- 
GitLab