@@ -62,6 +62,54 @@ public function dataConnectionConfig(): Generator
6262 ],
6363 ];
6464
65+ yield 'IPv4 ' => [
66+ 'expectedUri ' => 'mongodb://1.2.3.4 ' ,
67+ 'expectedDatabaseName ' => 'tests ' ,
68+ 'config ' => [
69+ 'host ' => '1.2.3.4 ' ,
70+ 'database ' => 'tests ' ,
71+ ],
72+ ];
73+
74+ yield 'IPv4 and port ' => [
75+ 'expectedUri ' => 'mongodb://1.2.3.4:1234 ' ,
76+ 'expectedDatabaseName ' => 'tests ' ,
77+ 'config ' => [
78+ 'host ' => '1.2.3.4 ' ,
79+ 'port ' => 1234 ,
80+ 'database ' => 'tests ' ,
81+ ],
82+ ];
83+
84+ yield 'IPv6 ' => [
85+ 'expectedUri ' => 'mongodb://[2001:db8:3333:4444:5555:6666:7777:8888] ' ,
86+ 'expectedDatabaseName ' => 'tests ' ,
87+ 'config ' => [
88+ 'host ' => '2001:db8:3333:4444:5555:6666:7777:8888 ' ,
89+ 'database ' => 'tests ' ,
90+ ],
91+ ];
92+
93+ yield 'IPv6 and port ' => [
94+ 'expectedUri ' => 'mongodb://[2001:db8:3333:4444:5555:6666:7777:8888]:1234 ' ,
95+ 'expectedDatabaseName ' => 'tests ' ,
96+ 'config ' => [
97+ 'host ' => '2001:db8:3333:4444:5555:6666:7777:8888 ' ,
98+ 'port ' => 1234 ,
99+ 'database ' => 'tests ' ,
100+ ],
101+ ];
102+
103+ yield 'multiple IPv6 ' => [
104+ 'expectedUri ' => 'mongodb://[::1],[2001:db8::1:0:0:1] ' ,
105+ 'expectedDatabaseName ' => 'tests ' ,
106+ 'config ' => [
107+ 'host ' => ['::1 ' , '2001:db8::1:0:0:1 ' ],
108+ 'port ' => null ,
109+ 'database ' => 'tests ' ,
110+ ],
111+ ];
112+
65113 yield 'Port in host name takes precedence ' => [
66114 'expectedUri ' => 'mongodb://some-host:12345 ' ,
67115 'expectedDatabaseName ' => 'tests ' ,
0 commit comments