summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-08-10 16:44:43 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-08-14 16:27:56 +0200
commitee756579a7d9af56f0aa36d4437e5c1c67f42309 (patch)
tree4a13677ddb45a9fab4e3ed351899cde2bda9ed5f /tests
parent2ea6c5364dfd672576824b65c1120c17b8c25c0f (diff)
downloadnextcloud-server-ee756579a7d9af56f0aa36d4437e5c1c67f42309.tar.gz
nextcloud-server-ee756579a7d9af56f0aa36d4437e5c1c67f42309.zip
Fix setting static property in tests on PHP 8.3
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/ViewTest.php4
-rw-r--r--tests/lib/TestCase.php6
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 18a6fca05b0..200b54d5829 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.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);
}
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index a242a51a887..f5fc9a6e8f2 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -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)) {