1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
<?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;
use function in_array;
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]'], true)) {
// 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();
}
}
|