File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ protected function withFreshQueryLog($callback)
214
214
protected function getDefaultDatabaseName (string $ dsn , array $ config ): string
215
215
{
216
216
if (empty ($ config ['database ' ])) {
217
- if (! preg_match ('/^mongodb(?:[+]srv)?: \\/ \\/.+ \\/([^?&]+)/s ' , $ dsn , $ matches )) {
217
+ if (! preg_match ('/^mongodb(?:[+]srv)?: \\/ \\/.+? \\/([^?&]+)/s ' , $ dsn , $ matches )) {
218
218
throw new InvalidArgumentException ('Database is not properly configured. ' );
219
219
}
220
220
Original file line number Diff line number Diff line change @@ -190,6 +190,12 @@ public static function dataConnectionConfig(): Generator
190
190
'expectedDatabaseName ' => 'tests ' ,
191
191
'config ' => ['dsn ' => 'mongodb://some-host:12345/tests ' ],
192
192
];
193
+
194
+ yield 'Database is extracted from DSN with CA path in options ' => [
195
+ 'expectedUri ' => 'mongodb://some-host:12345/tests?tls=true&tlsCAFile=/path/to/ca.pem&retryWrites=false ' ,
196
+ 'expectedDatabaseName ' => 'tests ' ,
197
+ 'config ' => ['dsn ' => 'mongodb://some-host:12345/tests?tls=true&tlsCAFile=/path/to/ca.pem&retryWrites=false ' ],
198
+ ];
193
199
}
194
200
195
201
#[DataProvider('dataConnectionConfig ' )]
You can’t perform that action at this time.
0 commit comments