Fix setting static property in tests on PHP 8.3

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/39866/head
Côme Chilliet 3 years ago
parent 2ea6c5364d
commit ee756579a7
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
  1. 4
      tests/lib/Files/ViewTest.php
  2. 6
      tests/lib/TestCase.php

@ -1568,10 +1568,10 @@ class ViewTest extends \Test\TestCase {
$defaultRootValue->setAccessible(true);
$oldRoot = $defaultRootValue->getValue();
$defaultView = new View('/foo/files');
$defaultRootValue->setValue($defaultView);
$defaultRootValue->setValue(null, $defaultView);
$view = new View($root);
$result = self::invokePrivate($view, 'shouldEmitHooks', [$path]);
$defaultRootValue->setValue($oldRoot);
$defaultRootValue->setValue(null, $oldRoot);
$this->assertEquals($shouldEmit, $result);
}

@ -230,7 +230,11 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
$property->setAccessible(true);
if (!empty($parameters)) {
$property->setValue($object, array_pop($parameters));
if ($property->isStatic()) {
$property->setValue(null, array_pop($parameters));
} else {
$property->setValue($object, array_pop($parameters));
}
}
if (is_object($object)) {

Loading…
Cancel
Save