diff --git a/system/Test/ReflectionHelper.php b/system/Test/ReflectionHelper.php index 8ada8e76da59..4c25e3decd89 100644 --- a/system/Test/ReflectionHelper.php +++ b/system/Test/ReflectionHelper.php @@ -74,7 +74,12 @@ private static function getAccessibleRefProperty($obj, $property) public static function setPrivateProperty($obj, $property, $value) { $refProperty = self::getAccessibleRefProperty($obj, $property); - $refProperty->setValue($obj, $value); + + if (is_object($obj)) { + $refProperty->setValue($obj, $value); + } else { + $refProperty->setValue(null, $value); + } } /** diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index e7a9264c8791..f0f455f8aeb7 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -438,13 +438,13 @@ public function testWindow(): void { $height = new ReflectionProperty(CLI::class, 'height'); $height->setAccessible(true); - $height->setValue(null); + $height->setValue(null, null); $this->assertIsInt(CLI::getHeight()); $width = new ReflectionProperty(CLI::class, 'width'); $width->setAccessible(true); - $width->setValue(null); + $width->setValue(null, null); $this->assertIsInt(CLI::getWidth()); }