@@ -102,9 +102,7 @@ public function testDbalLoadFromXmlMultipleConnections(): void
102
102
public function testDbalLoadFromXmlSingleConnections (): void
103
103
{
104
104
$ container = $ this ->loadContainer ('dbal_service_single_connection ' );
105
-
106
- // doctrine.dbal.mysql_connection
107
- $ config = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
105
+ $ config = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
108
106
109
107
$ this ->assertEquals ('mysql_s3cr3t ' , $ config ['password ' ]);
110
108
$ this ->assertEquals ('mysql_user ' , $ config ['user ' ]);
@@ -116,9 +114,7 @@ public function testDbalLoadFromXmlSingleConnections(): void
116
114
public function testDbalLoadUrlOverride (): void
117
115
{
118
116
$ container = $ this ->loadContainer ('dbal_allow_url_override ' );
119
-
120
- // doctrine.dbal.mysql_connection
121
- $ config = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
117
+ $ config = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
122
118
123
119
$ this ->assertSame ('mysql://root:password@database:3306/main?serverVersion=mariadb-10.5.8 ' , $ config ['url ' ]);
124
120
@@ -130,20 +126,15 @@ public function testDbalLoadUrlOverride(): void
130
126
'port ' => 4321 ,
131
127
];
132
128
133
- foreach ($ expectedOverrides as $ param => $ value ) {
134
- $ this ->assertSame ($ value , $ config [$ param ]);
135
- }
136
-
129
+ $ this ->assertEquals ($ expectedOverrides , array_intersect_key ($ config , $ expectedOverrides ));
137
130
$ this ->assertSame ($ expectedOverrides , $ config ['connection_override_options ' ]);
138
131
$ this ->assertFalse (isset ($ config ['override_url ' ]));
139
132
}
140
133
141
134
public function testDbalLoadPartialUrlOverrideSetsDefaults (): void
142
135
{
143
136
$ container = $ this ->loadContainer ('dbal_allow_partial_url_override ' );
144
-
145
- // doctrine.dbal.mysql_connection
146
- $ config = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
137
+ $ config = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
147
138
148
139
$ expectedDefaults = [
149
140
'host ' => 'localhost ' ,
@@ -152,10 +143,7 @@ public function testDbalLoadPartialUrlOverrideSetsDefaults(): void
152
143
'port ' => null ,
153
144
];
154
145
155
- foreach ($ expectedDefaults as $ paramName => $ defaultConfigValue ) {
156
- $ this ->assertSame ($ defaultConfigValue , $ config [$ paramName ]);
157
- }
158
-
146
+ $ this ->assertEquals ($ expectedDefaults , array_intersect_key ($ config , $ expectedDefaults ));
159
147
$ this ->assertSame ('mysql://root:password@database:3306/main?serverVersion=mariadb-10.5.8 ' , $ config ['url ' ]);
160
148
$ this ->assertCount (1 , $ config ['connection_override_options ' ]);
161
149
$ this ->assertSame ('main_test ' , $ config ['connection_override_options ' ]['dbname ' ]);
@@ -165,9 +153,7 @@ public function testDbalLoadPartialUrlOverrideSetsDefaults(): void
165
153
public function testDbalLoadSingleMasterSlaveConnection (): void
166
154
{
167
155
$ container = $ this ->loadContainer ('dbal_service_single_master_slave_connection ' );
168
-
169
- // doctrine.dbal.mysql_connection
170
- $ param = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
156
+ $ param = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
171
157
172
158
$ this ->assertEquals (
173
159
class_exists (PrimaryReadReplicaConnection::class) ?
@@ -206,9 +192,7 @@ class_exists(PrimaryReadReplicaConnection::class) ?
206
192
public function testDbalLoadPoolShardingConnection (): void
207
193
{
208
194
$ container = $ this ->loadContainer ('dbal_service_pool_sharding_connection ' );
209
-
210
- // doctrine.dbal.mysql_connection
211
- $ param = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
195
+ $ param = $ container ->getDefinition ('doctrine.dbal.default_connection ' )->getArgument (0 );
212
196
213
197
$ this ->assertEquals ('Doctrine \\DBAL \\Sharding \\PoolingShardConnection ' , $ param ['wrapperClass ' ]);
214
198
$ this ->assertEquals (new Reference ('foo.shard_choser ' ), $ param ['shardChoser ' ]);
0 commit comments