fix(reflection): ReflectionMethod::setAccessible is noop since 8.1

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2025-12-18 08:05:51 +01:00
parent 6bc73b0dab
commit 56793fa5b8
No known key found for this signature in database
GPG key ID: F72FA5B49FFA96B0
3 changed files with 0 additions and 8 deletions

View file

@ -375,7 +375,6 @@ class SharedMountTest extends TestCase {
$mountProvider = Server::get(MountProvider::class);
$reflectionClass = new \ReflectionClass($mountProvider);
$reflectionCacheFactory = $reflectionClass->getProperty('cacheFactory');
$reflectionCacheFactory->setAccessible(true);
$reflectionCacheFactory->setValue($mountProvider, $cacheFactory);
// share to user

View file

@ -102,14 +102,12 @@ class HelperStorageTest extends \Test\TestCase {
private function getIncludeExternalStorage(): bool {
$class = new \ReflectionClass(\OC_Helper::class);
$prop = $class->getProperty('quotaIncludeExternalStorage');
$prop->setAccessible(true);
return $prop->getValue(null) ?? false;
}
private function setIncludeExternalStorage(bool $include) {
$class = new \ReflectionClass(\OC_Helper::class);
$prop = $class->getProperty('quotaIncludeExternalStorage');
$prop->setAccessible(true);
$prop->setValue(null, $include);
}

View file

@ -248,15 +248,10 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
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);
if (!empty($parameters)) {
if ($property->isStatic()) {
$property->setValue(null, array_pop($parameters));