forked from Wavyzz/dolibarr
Fix: Pb in json function for objects
This commit is contained in:
@@ -28,7 +28,6 @@ global $conf,$user,$langs,$db;
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/core/lib/json.lib.php';
|
||||
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
@@ -478,37 +477,6 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($verifcond);
|
||||
}
|
||||
|
||||
/**
|
||||
* testJsonencode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testJsonEncode()
|
||||
{
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
$arraytotest=array(0=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
|
||||
|
||||
$encoded=json_encode($arraytotest);
|
||||
//var_dump($encoded);
|
||||
$this->assertEquals('[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]',$encoded);
|
||||
$decoded=json_decode($encoded,true);
|
||||
//var_dump($decoded);
|
||||
$this->assertEquals($arraytotest,$decoded);
|
||||
|
||||
$encoded=dol_json_encode($arraytotest);
|
||||
//var_dump($encoded);
|
||||
$this->assertEquals('[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]',$encoded);
|
||||
$decoded=dol_json_decode($encoded,true);
|
||||
//var_dump($decoded);
|
||||
$this->assertEquals($arraytotest,$decoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetDefaultTva
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user