Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/categories/class/categorie.class.php
	htdocs/core/class/commondocgenerator.class.php
	htdocs/core/lib/functions.lib.php
	htdocs/core/modules/DolibarrModules.class.php
	htdocs/filefunc.inc.php
	htdocs/societe/class/societe.class.php
	htdocs/supplier_proposal/class/supplier_proposal.class.php
This commit is contained in:
Laurent Destailleur
2017-07-07 15:11:53 +02:00
16 changed files with 195 additions and 130 deletions

View File

@@ -132,21 +132,21 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
/*$tmp=dol_buildpath('/google/oauth2callback.php', 0);
var_dump($tmp);
*/
/*$tmp=dol_buildpath('/google/oauth2callback.php', 1);
var_dump($tmp);
*/
$result=dol_buildpath('/google/oauth2callback.php', 2);
print __METHOD__." result=".$result."\n";
$this->assertStringStartsWith('http', $result);
$result=dol_buildpath('/google/oauth2callback.php', 3);
print __METHOD__." result=".$result."\n";
$this->assertStringStartsWith('http', $result);
}
/**
* testGetBrowserInfo
*
@@ -512,32 +512,48 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
// Default trunc (will add ... if truncation truncation or keep last char if only one char)
$input="éeéeéeàa";
$after=dol_trunc($input,3);
$this->assertEquals("éeé...",$after);
$this->assertEquals("éeé...",$after,'Test A1');
$after=dol_trunc($input,2);
$this->assertEquals("ée...",$after);
$this->assertEquals("ée...",$after,'Test A2');
$after=dol_trunc($input,1);
$this->assertEquals("é...",$after,'Test A3');
$input="éeéeé";
$after=dol_trunc($input,3);
$this->assertEquals("éeéeé",$after,'Test B1');
$after=dol_trunc($input,2);
$this->assertEquals("éeéeé",$after,'Test B2');
$after=dol_trunc($input,1);
$this->assertEquals("é...",$after,'Test B3');
$input="éeée";
$after=dol_trunc($input,3);
$this->assertEquals("éeée",$after,'Test C1');
$after=dol_trunc($input,2);
$this->assertEquals("éeée",$after,'Test C2');
$after=dol_trunc($input,1);
$this->assertEquals("éeée",$after,'Test C3');
$input="éeé";
$after=dol_trunc($input,3);
$this->assertEquals("éeé",$after);
$this->assertEquals("éeé",$after,'Test C');
$after=dol_trunc($input,2);
$this->assertEquals("éeé",$after);
$this->assertEquals("éeé",$after,'Test D');
$after=dol_trunc($input,1);
$this->assertEquals("é...",$after);
$this->assertEquals("é",$after,'Test E');
// Trunc with no ...
$input="éeéeéeàa";
$after=dol_trunc($input,3,'right','UTF-8',1);
$this->assertEquals("éeé",$after);
$this->assertEquals("éeé",$after,'Test F');
$after=dol_trunc($input,2,'right','UTF-8',1);
$this->assertEquals("ée",$after);
$this->assertEquals("ée",$after,'Test G');
$input="éeé";
$after=dol_trunc($input,3,'right','UTF-8',1);
$this->assertEquals("éeé",$after);
$this->assertEquals("éeé",$after,'Test H');
$after=dol_trunc($input,2,'right','UTF-8',1);
$this->assertEquals("ée",$after);
$this->assertEquals("ée",$after,'Test I');
$after=dol_trunc($input,1,'right','UTF-8',1);
$this->assertEquals("é",$after);
$this->assertEquals("é",$after,'Test J');
$input="éeéeéeàa";
$after=dol_trunc($input,4,'middle');
$this->assertEquals("ée...àa",$after);
$this->assertEquals("ée...àa",$after,'Test K');
return true;
}
@@ -668,7 +684,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals("21 jump street\nMyTown, MyState, 99999",$address);
}
/**
* testDolFormatAddress
*
@@ -681,18 +697,18 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$object=new Societe($db);
$object->initAsSpecimen();
$object->country_code='FR';
$phone=dol_print_phone('1234567890', $object->country_code);
$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('<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('<span style="margin-right: 10px;">12 34 56 78 90</span>', $phone, 'Phone for FR 3');
@@ -700,10 +716,10 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$object->country_code='CA';
$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
$this->assertEquals('<span style="margin-right: 10px;">(123) 456-7890</span>', $phone, 'Phone for CA 1');
}
/**
* testImgPicto
*
@@ -1053,5 +1069,5 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
return true;
}
}