|
35 | 35 | use function PHPUnit\Framework\assertIsString;
|
36 | 36 | use function PHPUnit\Framework\assertNotEmpty;
|
37 | 37 | use function PHPUnit\Framework\assertNotFalse;
|
38 |
| -use function PHPUnit\Framework\assertStringContainsString; |
39 |
| -use function PHPUnit\Framework\assertStringStartsWith; |
40 | 38 | use function preg_match;
|
41 | 39 | use function preg_replace;
|
42 | 40 | use function sprintf;
|
|
48 | 46 | use const DIRECTORY_SEPARATOR;
|
49 | 47 | use const FILTER_VALIDATE_BOOLEAN;
|
50 | 48 | use const PATH_SEPARATOR;
|
51 |
| -use const PHP_URL_HOST; |
52 | 49 |
|
53 | 50 | /**
|
54 | 51 | * Unified test runner.
|
@@ -531,14 +528,15 @@ private function createContext(): Context
|
531 | 528 | // We assume the internal client URI has multiple mongos hosts
|
532 | 529 | $multiMongosUri = $this->internalClientUri;
|
533 | 530 |
|
534 |
| - /* TODO: If an SRV URI is provided, we can consider connecting and |
535 |
| - * checking the topology for multiple mongoses and then selecting a |
536 |
| - * single mongos to reconstruct a single mongos URI; however, that |
537 |
| - * may omit necessary URI options provided by TXT records. */ |
538 |
| - assertStringStartsWith('mongodb://', $multiMongosUri); |
539 |
| - assertStringContainsString(',', parse_url($multiMongosUri, PHP_URL_HOST)); |
540 |
| - |
541 |
| - $singleMongosUri = self::removeMultipleHosts($multiMongosUri); |
| 531 | + if (strpos($multiMongosUri, 'mongodb+srv://') === 0) { |
| 532 | + /* TODO: If an SRV URI is provided, we can consider connecting and |
| 533 | + * checking the topology for multiple mongoses and then selecting a |
| 534 | + * single mongos to reconstruct a single mongos URI; however, that |
| 535 | + * may omit necessary URI options provided by TXT records. */ |
| 536 | + $singleMongosUri = $multiMongosUri; |
| 537 | + } else { |
| 538 | + $singleMongosUri = self::removeMultipleHosts($multiMongosUri); |
| 539 | + } |
542 | 540 |
|
543 | 541 | $context->setUrisForUseMultipleMongoses($singleMongosUri, $multiMongosUri);
|
544 | 542 | }
|
|
0 commit comments