@@ -349,17 +349,24 @@ public function testLoadSimpleSingleConnection(): void
349349
350350 $ definition = $ container ->getDefinition ('doctrine.dbal.default_connection ' );
351351
352- $ this ->assertDICConstructorArguments ($ definition , $ this ->getFactoryArguments ([
353- 'dbname ' => 'db ' ,
354- 'host ' => 'localhost ' ,
355- 'port ' => null ,
356- 'user ' => 'root ' ,
357- 'password ' => null ,
358- 'driver ' => 'pdo_mysql ' ,
359- 'driverOptions ' => [],
360- 'defaultTableOptions ' => [],
361- 'idle_connection_ttl ' => 600 ,
362- ]));
352+ $ this ->assertDICConstructorArguments ($ definition , [
353+ [
354+ 'dbname ' => 'db ' ,
355+ 'host ' => 'localhost ' ,
356+ 'port ' => null ,
357+ 'user ' => 'root ' ,
358+ 'password ' => null ,
359+ 'driver ' => 'pdo_mysql ' ,
360+ 'driverOptions ' => [],
361+ 'defaultTableOptions ' => [],
362+ 'idle_connection_ttl ' => 600 ,
363+ ],
364+ new Reference ('doctrine.dbal.default_connection.configuration ' ),
365+ method_exists (Connection::class, 'getEventManager ' )
366+ ? new Reference ('doctrine.dbal.default_connection.event_manager ' )
367+ : null ,
368+ [],
369+ ]);
363370
364371 $ definition = $ container ->getDefinition ('doctrine.orm.default_entity_manager ' );
365372 $ this ->assertEquals ('%doctrine.orm.entity_manager.class% ' , $ definition ->getClass ());
@@ -383,9 +390,8 @@ public function testLoadSimpleSingleConnectionWithoutDbName(): void
383390
384391 $ container = $ this ->loadContainer ('orm_service_simple_single_entity_manager_without_dbname ' );
385392
386- $ this ->assertDICConstructorArguments (
387- $ container ->getDefinition ('doctrine.dbal.default_connection ' ),
388- $ this ->getFactoryArguments ([
393+ $ this ->assertDICConstructorArguments ($ container ->getDefinition ('doctrine.dbal.default_connection ' ), [
394+ [
389395 'host ' => 'localhost ' ,
390396 'port ' => null ,
391397 'user ' => 'root ' ,
@@ -394,8 +400,13 @@ public function testLoadSimpleSingleConnectionWithoutDbName(): void
394400 'driverOptions ' => [],
395401 'defaultTableOptions ' => [],
396402 'idle_connection_ttl ' => 600 ,
397- ]),
398- );
403+ ],
404+ new Reference ('doctrine.dbal.default_connection.configuration ' ),
405+ method_exists (Connection::class, 'getEventManager ' )
406+ ? new Reference ('doctrine.dbal.default_connection.event_manager ' )
407+ : null ,
408+ [],
409+ ]);
399410
400411 $ definition = $ container ->getDefinition ('doctrine.orm.default_entity_manager ' );
401412 $ this ->assertEquals ('%doctrine.orm.entity_manager.class% ' , $ definition ->getClass ());
@@ -417,18 +428,25 @@ public function testLoadSingleConnection(): void
417428
418429 $ definition = $ container ->getDefinition ('doctrine.dbal.default_connection ' );
419430
420- $ this ->assertDICConstructorArguments ($ definition , $ this ->getFactoryArguments ([
421- 'host ' => 'localhost ' ,
422- 'driver ' => 'pdo_sqlite ' ,
423- 'driverOptions ' => [],
424- 'user ' => 'sqlite_user ' ,
425- 'port ' => null ,
426- 'password ' => 'sqlite_s3cr3t ' ,
427- 'dbname ' => 'sqlite_db ' ,
428- 'memory ' => true ,
429- 'defaultTableOptions ' => [],
430- 'idle_connection_ttl ' => 600 ,
431- ]));
431+ $ this ->assertDICConstructorArguments ($ definition , [
432+ [
433+ 'host ' => 'localhost ' ,
434+ 'driver ' => 'pdo_sqlite ' ,
435+ 'driverOptions ' => [],
436+ 'user ' => 'sqlite_user ' ,
437+ 'port ' => null ,
438+ 'password ' => 'sqlite_s3cr3t ' ,
439+ 'dbname ' => 'sqlite_db ' ,
440+ 'memory ' => true ,
441+ 'defaultTableOptions ' => [],
442+ 'idle_connection_ttl ' => 600 ,
443+ ],
444+ new Reference ('doctrine.dbal.default_connection.configuration ' ),
445+ method_exists (Connection::class, 'getEventManager ' )
446+ ? new Reference ('doctrine.dbal.default_connection.event_manager ' )
447+ : null ,
448+ [],
449+ ]);
432450
433451 $ definition = $ container ->getDefinition ('doctrine.orm.default_entity_manager ' );
434452 $ this ->assertEquals ('%doctrine.orm.entity_manager.class% ' , $ definition ->getClass ());
@@ -1752,26 +1770,6 @@ private function compileContainer(ContainerBuilder $container): void
17521770 $ passConfig ->addPass (new CacheCompatibilityPass ());
17531771 $ container ->compile ();
17541772 }
1755-
1756- /**
1757- * @param array<string, mixed> $params
1758- *
1759- * @return list<mixed> The expected arguments to the connection factory
1760- */
1761- private function getFactoryArguments (array $ params ): array
1762- {
1763- $ args = [
1764- $ params ,
1765- new Reference ('doctrine.dbal.default_connection.configuration ' ),
1766- ];
1767- if (method_exists (Connection::class, 'getEventManager ' )) {
1768- $ args [] = new Reference ('doctrine.dbal.default_connection.event_manager ' );
1769- }
1770-
1771- $ args [] = [];
1772-
1773- return $ args ;
1774- }
17751773}
17761774
17771775class DummySchemaAssetsFilter
0 commit comments