Removed Driver::getName()

The method is not used for anything else than skipping tests for specific drivers. Cross-driver portability should be established by drivers, not outside of them based on their name.
parent 5e7ceff8
# Upgrade to 3.0
## BC BREAK: `Doctrine\DBAL\Driver::getName()` removed
The `Doctrine\DBAL\Driver::getName()` has been removed.
## BC BREAK Removed previously deprecated features
* Removed `json_array` type and all associated hacks.
......
......@@ -40,15 +40,6 @@ interface Driver
*/
public function getSchemaManager(Connection $conn);
/**
* Gets the name of the driver.
*
* @deprecated
*
* @return string The name of the driver.
*/
public function getName();
/**
* Gets the name of the database connected to for this driver.
*
......
......@@ -22,14 +22,4 @@ class DB2Driver extends AbstractDB2Driver
$params['driver_options'] ?? []
);
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'ibm_db2';
}
}
......@@ -113,12 +113,4 @@ class Driver extends AbstractMySQLDriver
return $initializers;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'mysqli';
}
}
......@@ -37,14 +37,4 @@ class Driver extends AbstractOracleDriver
{
return $this->getEasyConnectString($params);
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'oci8';
}
}
......@@ -62,14 +62,4 @@ class Driver extends AbstractMySQLDriver
return $dsn;
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_mysql';
}
}
......@@ -52,12 +52,4 @@ class Driver extends AbstractOracleDriver
return $dsn;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'pdo_oracle';
}
}
......@@ -107,14 +107,4 @@ class Driver extends AbstractPostgreSQLDriver
return $dsn;
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_pgsql';
}
}
......@@ -69,14 +69,4 @@ class Driver extends AbstractSQLiteDriver
return $dsn;
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_sqlite';
}
}
......@@ -88,14 +88,4 @@ class Driver extends AbstractSQLServerDriver
return $connectionOptionsDsn;
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_sqlsrv';
}
}
......@@ -47,14 +47,4 @@ class Driver extends AbstractSQLServerDriver
return new SQLSrvConnection($serverName, $driverOptions);
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'sqlsrv';
}
}
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractDB2DriverTest;
class DB2DriverTest extends AbstractDB2DriverTest
{
public function testReturnsName(): void
{
self::assertSame('ibm_db2', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new DB2Driver();
......
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest;
class DriverTest extends AbstractMySQLDriverTest
{
public function testReturnsName(): void
{
self::assertSame('mysqli', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new Driver();
......
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest;
class DriverTest extends AbstractOracleDriverTest
{
public function testReturnsName(): void
{
self::assertSame('oci8', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new Driver();
......
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest;
class DriverTest extends AbstractMySQLDriverTest
{
public function testReturnsName(): void
{
self::assertSame('pdo_mysql', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new Driver();
......
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest;
class DriverTest extends AbstractOracleDriverTest
{
public function testReturnsName(): void
{
self::assertSame('pdo_oracle', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new Driver();
......
......@@ -4,77 +4,68 @@ namespace Doctrine\DBAL\Tests\Driver\PDOPgSql;
use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOPgSql\Driver;
use Doctrine\DBAL\Tests\Driver\AbstractPostgreSQLDriverTest;
use Doctrine\DBAL\Tests\TestUtil;
use PDO;
use PDOException;
use function array_merge;
class DriverTest extends AbstractPostgreSQLDriverTest
{
public function testReturnsName(): void
protected function setUp(): void
{
self::assertSame('pdo_pgsql', $this->driver->getName());
parent::setUp();
if (isset($GLOBALS['db_type']) && $GLOBALS['db_driver'] === 'pdo_pgsql') {
return;
}
$this->markTestSkipped('Test enabled only when using pdo_pgsql specific phpunit.xml');
}
/**
* @group DBAL-920
*/
public function testConnectionDisablesPreparesOnPhp56(): void
public function testConnectionDisablesPrepares(): void
{
$this->skipWhenNotUsingPdoPgsql();
$connection = $this->connect([]);
try {
self::assertTrue($connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
} catch (PDOException $ignored) {
/** @link https://bugs.php.net/bug.php?id=68371 */
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
}
self::assertInstanceOf(PDOConnection::class, $connection);
self::assertTrue(
$connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
);
}
/**
* @group DBAL-920
*/
public function testConnectionDoesNotDisablePreparesOnPhp56WhenAttributeDefined(): void
public function testConnectionDoesNotDisablePreparesWhenAttributeDefined(): void
{
$this->skipWhenNotUsingPdoPgsql();
$connection = $this->connect(
[PDO::PGSQL_ATTR_DISABLE_PREPARES => false]
);
try {
self::assertNotSame(
true,
$connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
);
} catch (PDOException $ignored) {
/** @link https://bugs.php.net/bug.php?id=68371 */
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
}
self::assertInstanceOf(PDOConnection::class, $connection);
self::assertNotTrue(
$connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
);
}
/**
* @group DBAL-920
*/
public function testConnectionDisablePreparesOnPhp56WhenDisablePreparesIsExplicitlyDefined(): void
public function testConnectionDisablePreparesWhenDisablePreparesIsExplicitlyDefined(): void
{
$this->skipWhenNotUsingPdoPgsql();
$connection = $this->connect(
[PDO::PGSQL_ATTR_DISABLE_PREPARES => true]
);
try {
self::assertTrue($connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
} catch (PDOException $ignored) {
/** @link https://bugs.php.net/bug.php?id=68371 */
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
}
self::assertInstanceOf(PDOConnection::class, $connection);
self::assertTrue(
$connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
);
}
protected function createDriver(): DriverInterface
......@@ -82,15 +73,6 @@ class DriverTest extends AbstractPostgreSQLDriverTest
return new Driver();
}
private function skipWhenNotUsingPdoPgsql(): void
{
if (isset($GLOBALS['db_driver']) && $GLOBALS['db_driver'] === 'pdo_pgsql') {
return;
}
$this->markTestSkipped('Test enabled only when using pdo_pgsql specific phpunit.xml');
}
/**
* @param array<int,mixed> $driverOptions
*/
......
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLiteDriverTest;
class DriverTest extends AbstractSQLiteDriverTest
{
public function testReturnsName(): void
{
self::assertSame('pdo_sqlite', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new Driver();
......
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest;
class DriverTest extends AbstractSQLServerDriverTest
{
public function testReturnsName(): void
{
self::assertSame('pdo_sqlsrv', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new Driver();
......
......@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest;
class DriverTest extends AbstractSQLServerDriverTest
{
public function testReturnsName(): void
{
self::assertSame('sqlsrv', $this->driver->getName());
}
protected function createDriver(): DriverInterface
{
return new Driver();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment