fix(tests): Force lazy ghost initialisation in container tests

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2025-05-05 10:17:19 +02:00
parent a42ef7d633
commit a10182f6fb
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

@ -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 {