File tree Expand file tree Collapse file tree 4 files changed +24
-11
lines changed Expand file tree Collapse file tree 4 files changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ public function disconnect()
151
151
}
152
152
153
153
/**
154
- * Determine if the given configuration array has a UNIX socket value .
154
+ * Determine if the given configuration array has a dsn string .
155
155
*
156
156
* @param array $config
157
157
* @return bool
@@ -162,22 +162,14 @@ protected function hasDsnString(array $config)
162
162
}
163
163
164
164
/**
165
- * Get the DSN string for a socket configuration.
165
+ * Get the DSN string form configuration.
166
166
*
167
167
* @param array $config
168
168
* @return string
169
169
*/
170
170
protected function getDsnString (array $ config )
171
171
{
172
- $ dsn_string = $ config ['dsn ' ];
173
-
174
- if (Str::contains ($ dsn_string , 'mongodb:// ' )) {
175
- $ dsn_string = Str::replaceFirst ('mongodb:// ' , '' , $ dsn_string );
176
- }
177
-
178
- $ dsn_string = rawurlencode ($ dsn_string );
179
-
180
- return "mongodb:// {$ dsn_string }" ;
172
+ return $ config ['dsn ' ];
181
173
}
182
174
183
175
/**
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ class DsnTest extends TestCase
4
+ {
5
+ public function test_dsn_works ()
6
+ {
7
+ $ this ->assertInstanceOf (\Illuminate \Database \Eloquent \Collection::class, DsnAddress::all ());
8
+ }
9
+ }
10
+
11
+ class DsnAddress extends Address
12
+ {
13
+ protected $ connection = 'dsn_mongodb ' ;
14
+ }
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ protected function getEnvironmentSetUp($app)
51
51
$ app ['config ' ]->set ('database.default ' , 'mongodb ' );
52
52
$ app ['config ' ]->set ('database.connections.mysql ' , $ config ['connections ' ]['mysql ' ]);
53
53
$ app ['config ' ]->set ('database.connections.mongodb ' , $ config ['connections ' ]['mongodb ' ]);
54
+ $ app ['config ' ]->set ('database.connections.dsn_mongodb ' , $ config ['connections ' ]['dsn_mongodb ' ]);
54
55
55
56
$ app ['config ' ]->set ('auth.model ' , 'User ' );
56
57
$ app ['config ' ]->set ('auth.providers.users.model ' , 'User ' );
Original file line number Diff line number Diff line change 11
11
'database ' => 'unittest ' ,
12
12
],
13
13
14
+ 'dsn_mongodb ' => [
15
+ 'driver ' => 'mongodb ' ,
16
+ 'dsn ' => 'mongodb://mongodb:27017 ' ,
17
+ 'database ' => 'unittest ' ,
18
+ ],
19
+
14
20
'mysql ' => [
15
21
'driver ' => 'mysql ' ,
16
22
'host ' => 'mysql ' ,
You can’t perform that action at this time.
0 commit comments