mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°5704 - Unit tests on XML assembly (#329)
* Add a complete test suite for XML assembly * Add a complete test suite for XML assembly * Dispatched the test of GetDelta into real unit tests * Add test for GetDelta on a rename operation * Add comments on a weird case and a case on rename * Update XML version after rebase from develop to support/2.7 * Fix phpdoc about coverage * Remove ModelFactory::GetRootDirs and ItopTestCase::RecurseRmDir+CreateTmpDir+RecurseMkDir+RecurseCopy, that were meant to be introduced in iTop 3.0 and have been copied here by mistake, when rebasing the branch from develop to 2.7.0 * Update test/ItopTestCase.php Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Update test/setup/ModelFactoryTest.php Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Update test/ItopTestCase.php Co-authored-by: Molkobain <lajarige.guillaume@free.fr> Co-authored-by: Pierre Goiffon <pierre.goiffon@combodo.com> Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
@@ -136,4 +136,40 @@ class ItopTestCase extends TestCase
|
||||
|
||||
return $method->invokeArgs($oObject, $aArgs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $oObject
|
||||
* @param string $sProperty
|
||||
*
|
||||
* @return mixed property
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
* @since 2.7.8 3.0.3 3.1.0
|
||||
*/
|
||||
public function GetNonPublicProperty(object $oObject, string $sProperty)
|
||||
{
|
||||
$class = new \ReflectionClass(get_class($oObject));
|
||||
$property = $class->getProperty($sProperty);
|
||||
$property->setAccessible(true);
|
||||
|
||||
return $property->getValue($oObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $oObject
|
||||
* @param string $sProperty
|
||||
* @param $value
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
* @since 2.7.8 3.0.3 3.1.0
|
||||
*/
|
||||
public function SetNonPublicProperty(object $oObject, string $sProperty, $value)
|
||||
{
|
||||
$class = new \ReflectionClass(get_class($oObject));
|
||||
$property = $class->getProperty($sProperty);
|
||||
$property->setAccessible(true);
|
||||
|
||||
$property->setValue($oObject, $value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user