diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-08-10 16:44:43 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-08-14 16:27:56 +0200 |
commit | ee756579a7d9af56f0aa36d4437e5c1c67f42309 (patch) | |
tree | 4a13677ddb45a9fab4e3ed351899cde2bda9ed5f /tests | |
parent | 2ea6c5364dfd672576824b65c1120c17b8c25c0f (diff) | |
download | nextcloud-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.php | 4 | ||||
-rw-r--r-- | tests/lib/TestCase.php | 6 |
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)) { |