Skip to content

Commit 440c840

Browse files
committed
Fix DSN tests
1 parent 1bdad59 commit 440c840

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

pkg/dbal/Tests/DbalConnectionFactoryConfigTest.php

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public static function provideConfigs()
5656
null,
5757
[
5858
'connection' => [
59-
'url' => 'mysql://root@localhost',
59+
'driver' => 'pdo_mysql',
60+
'host' => 'localhost',
61+
'user' => 'root',
6062
],
6163
'table_name' => 'enqueue',
6264
'polling_interval' => 1000,
@@ -68,7 +70,9 @@ public static function provideConfigs()
6870
'mysql:',
6971
[
7072
'connection' => [
71-
'url' => 'mysql://root@localhost',
73+
'driver' => 'pdo_mysql',
74+
'host' => 'localhost',
75+
'user' => 'root',
7276
],
7377
'table_name' => 'enqueue',
7478
'polling_interval' => 1000,
@@ -80,7 +84,9 @@ public static function provideConfigs()
8084
'mysql+pdo:',
8185
[
8286
'connection' => [
83-
'url' => 'pdo_mysql://root@localhost',
87+
'driver' => 'pdo_mysql',
88+
'host' => 'localhost',
89+
'user' => 'root',
8490
],
8591
'table_name' => 'enqueue',
8692
'polling_interval' => 1000,
@@ -92,7 +98,9 @@ public static function provideConfigs()
9298
'pgsql:',
9399
[
94100
'connection' => [
95-
'url' => 'pgsql://root@localhost',
101+
'driver' => 'pgsql',
102+
'host' => 'localhost',
103+
'user' => 'root',
96104
],
97105
'table_name' => 'enqueue',
98106
'polling_interval' => 1000,
@@ -158,7 +166,12 @@ public static function provideConfigs()
158166
[
159167
'connection' => [
160168
'foo' => 'fooValue',
161-
'url' => 'pdo_mysql://user:pass@host:10000/db',
169+
'driver' => 'pdo_mysql',
170+
'host' => 'host',
171+
'port' => 10000,
172+
'user' => 'user',
173+
'password' => 'pass',
174+
'dbname' => 'db',
162175
],
163176
'table_name' => 'enqueue',
164177
'polling_interval' => 1000,
@@ -171,6 +184,12 @@ public static function provideConfigs()
171184
[
172185
'connection' => [
173186
'url' => 'mysql://user:pass@host:10000/db',
187+
'driver' => 'pdo_mysql',
188+
'host' => 'host',
189+
'port' => 10000,
190+
'user' => 'user',
191+
'password' => 'pass',
192+
'dbname' => 'db',
174193
],
175194
'table_name' => 'enqueue',
176195
'polling_interval' => 1000,
@@ -182,7 +201,12 @@ public static function provideConfigs()
182201
'mysql+pdo://user:pass@host:10001/db',
183202
[
184203
'connection' => [
185-
'url' => 'pdo_mysql://user:pass@host:10001/db',
204+
'driver' => 'pdo_mysql',
205+
'host' => 'host',
206+
'port' => 10001,
207+
'user' => 'user',
208+
'password' => 'pass',
209+
'dbname' => 'db',
186210
],
187211
'table_name' => 'enqueue',
188212
'polling_interval' => 1000,
@@ -194,7 +218,9 @@ public static function provideConfigs()
194218
[],
195219
[
196220
'connection' => [
197-
'url' => 'mysql://root@localhost',
221+
'driver' => 'pdo_mysql',
222+
'host' => 'localhost',
223+
'user' => 'root',
198224
],
199225
'table_name' => 'enqueue',
200226
'polling_interval' => 1000,
@@ -219,7 +245,12 @@ public static function provideConfigs()
219245
['dsn' => 'mysql+pdo://user:pass@host:10001/db', 'foo' => 'fooVal'],
220246
[
221247
'connection' => [
222-
'url' => 'pdo_mysql://user:pass@host:10001/db',
248+
'driver' => 'pdo_mysql',
249+
'host' => 'host',
250+
'port' => 10001,
251+
'user' => 'user',
252+
'password' => 'pass',
253+
'dbname' => 'db',
223254
],
224255
'table_name' => 'enqueue',
225256
'polling_interval' => 1000,

pkg/dbal/Tests/DbalConnectionFactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function testShouldParseGenericDSN()
4141

4242
$config = $context->getConfig();
4343
$this->assertArrayHasKey('connection', $config);
44-
$this->assertArrayHasKey('url', $config['connection']);
45-
$this->assertEquals('pdo_pgsql://foo@bar', $config['connection']['url']);
44+
$this->assertArrayHasKey('driver', $config['connection']);
45+
$this->assertEquals('pdo_pgsql', $config['connection']['driver']);
4646
}
4747

4848
public function testShouldParseSqliteAbsolutePathDSN()
@@ -55,7 +55,7 @@ public function testShouldParseSqliteAbsolutePathDSN()
5555

5656
$config = $context->getConfig();
5757
$this->assertArrayHasKey('connection', $config);
58-
$this->assertArrayHasKey('url', $config['connection']);
58+
$this->assertArrayHasKey('driver', $config['connection']);
5959
$this->assertEquals('pdo_sqlite:////tmp/some.sq3', $config['connection']['url']);
6060
}
6161
}

0 commit comments

Comments
 (0)