Browse Source

Fix phpunit regression

Laurent Destailleur 1 year ago
parent
commit
c1b74f9338
2 changed files with 5 additions and 5 deletions
  1. 1 1
      htdocs/core/lib/functions.lib.php
  2. 4 4
      test/phpunit/FunctionsLibTest.php

+ 1 - 1
htdocs/core/lib/functions.lib.php

@@ -3704,7 +3704,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
 		$rep .= $newphoneastart;
 		$rep .= ($withpicto ? img_picto($titlealt, 'object_'.$picto.'.png') : '');
 		if ($separ != 'hidenum') {
-			$rep .= ' '.$newphone;
+			$rep .= ($withpicto ? ' ' : '').$newphone;
 		}
 		$rep .= $newphoneaend;
 

+ 4 - 4
test/phpunit/FunctionsLibTest.php

@@ -1092,19 +1092,19 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
 
 		$object->country_code='FR';
 		$phone=dol_print_phone('1234567890', $object->country_code);
-		$this->assertEquals($phone, '<span style="margin-right: 10px;">12&nbsp;34&nbsp;56&nbsp;78&nbsp;90</span>', 'Phone for FR 1');
+		$this->assertEquals('<span style="margin-right: 10px;">12&nbsp;34&nbsp;56&nbsp;78&nbsp;90</span>', $phone, 'Phone for FR 1');
 
 		$object->country_code='FR';
 		$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, '');
-		$this->assertEquals($phone, '<span style="margin-right: 10px;">1234567890</span>', 'Phone for FR 2');
+		$this->assertEquals('<span style="margin-right: 10px;">1234567890</span>', $phone, 'Phone for FR 2');
 
 		$object->country_code='FR';
 		$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
-		$this->assertEquals($phone, '<span style="margin-right: 10px;">12 34 56 78 90</span>', 'Phone for FR 3');
+		$this->assertEquals('<span style="margin-right: 10px;">12 34 56 78 90</span>', $phone, 'Phone for FR 3');
 
 		$object->country_code='CA';
 		$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
-		$this->assertEquals($phone, '<span style="margin-right: 10px;">(123) 456-7890</span>', 'Phone for CA 1');
+		$this->assertEquals('<span style="margin-right: 10px;">(123) 456-7890</span>', $phone, 'Phone for CA 1');
 	}