|
|
@@ -496,4 +496,32 @@ class Test_Helper extends PHPUnit_Framework_TestCase { |
|
|
|
\OC_Helper::rmdirr($baseDir); |
|
|
|
$this->assertFalse(file_exists($baseDir)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Allows us to test private methods/properties |
|
|
|
* |
|
|
|
* @param $object |
|
|
|
* @param $methodName |
|
|
|
* @param array $parameters |
|
|
|
* @return mixed |
|
|
|
*/ |
|
|
|
public static function invokePrivate($object, $methodName, array $parameters = array()) { |
|
|
|
$reflection = new ReflectionClass(get_class($object)); |
|
|
|
|
|
|
|
if ($reflection->hasMethod($methodName)) { |
|
|
|
$method = $reflection->getMethod($methodName); |
|
|
|
|
|
|
|
$method->setAccessible(true); |
|
|
|
|
|
|
|
return $method->invokeArgs($object, $parameters); |
|
|
|
} elseif ($reflection->hasProperty($methodName)) { |
|
|
|
$property = $reflection->getProperty($methodName); |
|
|
|
|
|
|
|
$property->setAccessible(true); |
|
|
|
|
|
|
|
return $property->getValue($object); |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |