Skip to content

Commit

Permalink
fix failure tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daalvand committed Aug 5, 2020
1 parent 5693764 commit dece761
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ClientConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public static function fromDsn(string $dsn): self
$clientConfiguration->set('password', \urldecode($parsedDsn['pass']));
}

if (isset($parsedDsn['pass']) && isset($parsedDsn['user'])) {
$clientConfiguration->set('auth_type', 'basic');
}


if (isset($parsedDsn['port'])) {
$clientConfiguration->set('port', $parsedDsn['port']);
}
Expand Down
5 changes: 5 additions & 0 deletions tests/ClientConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function testFromSimpleDsn(): void
'bigintConversion' => false,
'username' => null,
'password' => null,
'auth_type' => null,
];

$this->assertEquals($expected, $configuration->getAll());
Expand All @@ -62,6 +63,7 @@ public function testFromDsnWithParameters(): void
'bigintConversion' => true,
'username' => 'user',
'password' => 'p4ss',
'auth_type' => 'basic',
'extra' => 'abc',
];

Expand All @@ -87,6 +89,7 @@ public function testFromEmptyArray(): void
'bigintConversion' => false,
'username' => null,
'password' => null,
'auth_type' => null
];

$this->assertEquals($expected, $configuration->getAll());
Expand Down Expand Up @@ -114,6 +117,7 @@ public function testFromArray(): void
'bigintConversion' => false,
'username' => 'Jdoe',
'password' => null,
'auth_type' => null,
'extra' => 'abc',
];

Expand Down Expand Up @@ -147,6 +151,7 @@ public function testGet(): void
'bigintConversion' => false,
'username' => null,
'password' => null,
'auth_type' => null,
];

$this->assertEquals($expected, $configuration->get(''));
Expand Down
1 change: 1 addition & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function testConstructWithDsn(): void
'bigintConversion' => false,
'username' => 'user',
'password' => 'p4ss',
'auth_type' => 'basic',
'connectionStrategy' => 'Simple',
];

Expand Down

0 comments on commit dece761

Please sign in to comment.