From a10182f6fb3eecd2b944f4842d8c51e07628049f Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Mon, 5 May 2025 10:17:19 +0200 Subject: fix(tests): Force lazy ghost initialisation in container tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- tests/lib/AppFramework/Utility/SimpleContainerTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests') 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 { -- cgit v1.2.3