-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(PgSQL): Allow to pass IPv6 address in URI notation for postgres
Signed-off-by: Ferdinand Thiessen <[email protected]>
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Tests\Driver\PgSQL; | ||
|
||
use Doctrine\DBAL\Driver as DriverInterface; | ||
use Doctrine\DBAL\Driver\PgSQL\Driver; | ||
use Doctrine\DBAL\Tests\Driver\AbstractPostgreSQLDriverTestCase; | ||
use Doctrine\DBAL\Tests\TestUtil; | ||
|
||
class DriverTest extends AbstractPostgreSQLDriverTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
if (isset($GLOBALS['db_driver']) && $GLOBALS['db_driver'] === 'pgsql') { | ||
return; | ||
} | ||
|
||
self::markTestSkipped('Test enabled only when using pgsql specific phpunit.xml'); | ||
} | ||
|
||
/** | ||
* Ensure we can handle URI notation for IPv6 addresses | ||
*/ | ||
public function testConnectionIPv6(): void | ||
{ | ||
if (!in_array($GLOBALS['db_host'], ['localhost', '127.0.0.1', '[::1]'])) { | ||
Check failure on line 30 in tests/Driver/PgSQL/DriverTest.php GitHub Actions / Coding Standards / Coding Standards (PHP: 8.3)
|
||
// We cannot assume that every contributor runs the same setup as our CI | ||
self::markTestSkipped('This test only works if there is a Postgres server listening on localhost.'); | ||
} | ||
|
||
self::expectNotToPerformAssertions(); | ||
|
||
$params = TestUtil::getConnectionParams(); | ||
$params['host'] = '[::1]'; | ||
|
||
$this->driver->connect($params); | ||
} | ||
|
||
protected function createDriver(): DriverInterface | ||
{ | ||
return new Driver(); | ||
} | ||
} |