aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2025-05-05 10:17:19 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2025-06-05 20:51:23 +0200
commita10182f6fb3eecd2b944f4842d8c51e07628049f (patch)
tree2ea7966bd96182eec0593c1129cea6c6f65c9c96 /tests
parenta42ef7d633703de8cccbec1460b7c88b48995572 (diff)
downloadnextcloud-server-a10182f6fb3eecd2b944f4842d8c51e07628049f.tar.gz
nextcloud-server-a10182f6fb3eecd2b944f4842d8c51e07628049f.zip
fix(tests): Force lazy ghost initialisation in container tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/Utility/SimpleContainerTest.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
index 754da8e5fb3..a1cc1e76aeb 100644
--- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php
+++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
@@ -36,7 +36,9 @@ class ClassComplexConstructor {
}
class ClassNullableUntypedConstructorArg {
+ public $class;
public function __construct($class) {
+ $this->class = $class;
}
}
class ClassNullableTypedConstructorArg {
@@ -217,6 +219,8 @@ class SimpleContainerTest extends \Test\TestCase {
$object = $this->container->query(
'Test\AppFramework\Utility\ClassComplexConstructor'
);
+ /* Use the object to trigger DI on PHP >= 8.4 */
+ get_object_vars($object);
}
public function testRegisterFactory(): void {
@@ -243,7 +247,11 @@ class SimpleContainerTest extends \Test\TestCase {
public function testQueryUntypedNullable(): void {
$this->expectException(\OCP\AppFramework\QueryException::class);
- $this->container->query(ClassNullableUntypedConstructorArg::class);
+ $object = $this->container->query(
+ ClassNullableUntypedConstructorArg::class
+ );
+ /* Use the object to trigger DI on PHP >= 8.4 */
+ get_object_vars($object);
}
public function testQueryTypedNullable(): void {