2
0
forked from Wavyzz/dolibarr

Normalized line endings to LF

This commit is contained in:
Raphaël Doursenaud
2013-06-05 16:12:07 +02:00
parent e9ed4472d4
commit 686f5add82
28 changed files with 496 additions and 496 deletions

View File

@@ -269,53 +269,53 @@ class UserTest extends PHPUnit_Framework_TestCase
}
/**
* Edit an object to test updates
*
* @param mixed &$localobject Object Facture
* @return void
*/
public function changeProperties(&$localobject)
{
$localobject->note='New note after update';
}
/**
* Compare all public properties values of 2 objects
*
* @param Object $oA Object operand 1
* @param Object $oB Object operand 2
* @param boolean $ignoretype False will not report diff if type of value differs
* @param array $fieldstoignorearray Array of fields to ignore in diff
* @return array Array with differences
*/
public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id'))
{
$retAr=array();
if (get_class($oA) !== get_class($oB))
{
$retAr[]="Supplied objects are not of same class.";
}
else
{
$oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA);
foreach($aKeys as $sKey)
{
if (in_array($sKey,$fieldstoignorearray)) continue;
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey])
{
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
}
if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey])
{
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
}
}
}
return $retAr;
/**
* Edit an object to test updates
*
* @param mixed &$localobject Object Facture
* @return void
*/
public function changeProperties(&$localobject)
{
$localobject->note='New note after update';
}
/**
* Compare all public properties values of 2 objects
*
* @param Object $oA Object operand 1
* @param Object $oB Object operand 2
* @param boolean $ignoretype False will not report diff if type of value differs
* @param array $fieldstoignorearray Array of fields to ignore in diff
* @return array Array with differences
*/
public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id'))
{
$retAr=array();
if (get_class($oA) !== get_class($oB))
{
$retAr[]="Supplied objects are not of same class.";
}
else
{
$oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA);
foreach($aKeys as $sKey)
{
if (in_array($sKey,$fieldstoignorearray)) continue;
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey])
{
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
}
if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey])
{
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
}
}
}
return $retAr;
}
}
?>