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 # 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 ## BC BREAK Removed previously deprecated features
* Removed `json_array` type and all associated hacks. * Removed `json_array` type and all associated hacks.
......
...@@ -40,15 +40,6 @@ interface Driver ...@@ -40,15 +40,6 @@ interface Driver
*/ */
public function getSchemaManager(Connection $conn); 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. * Gets the name of the database connected to for this driver.
* *
......
...@@ -22,14 +22,4 @@ class DB2Driver extends AbstractDB2Driver ...@@ -22,14 +22,4 @@ class DB2Driver extends AbstractDB2Driver
$params['driver_options'] ?? [] $params['driver_options'] ?? []
); );
} }
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'ibm_db2';
}
} }
...@@ -113,12 +113,4 @@ class Driver extends AbstractMySQLDriver ...@@ -113,12 +113,4 @@ class Driver extends AbstractMySQLDriver
return $initializers; return $initializers;
} }
/**
* {@inheritdoc}
*/
public function getName()
{
return 'mysqli';
}
} }
...@@ -37,14 +37,4 @@ class Driver extends AbstractOracleDriver ...@@ -37,14 +37,4 @@ class Driver extends AbstractOracleDriver
{ {
return $this->getEasyConnectString($params); return $this->getEasyConnectString($params);
} }
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'oci8';
}
} }
...@@ -62,14 +62,4 @@ class Driver extends AbstractMySQLDriver ...@@ -62,14 +62,4 @@ class Driver extends AbstractMySQLDriver
return $dsn; return $dsn;
} }
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_mysql';
}
} }
...@@ -52,12 +52,4 @@ class Driver extends AbstractOracleDriver ...@@ -52,12 +52,4 @@ class Driver extends AbstractOracleDriver
return $dsn; return $dsn;
} }
/**
* {@inheritdoc}
*/
public function getName()
{
return 'pdo_oracle';
}
} }
...@@ -107,14 +107,4 @@ class Driver extends AbstractPostgreSQLDriver ...@@ -107,14 +107,4 @@ class Driver extends AbstractPostgreSQLDriver
return $dsn; return $dsn;
} }
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_pgsql';
}
} }
...@@ -69,14 +69,4 @@ class Driver extends AbstractSQLiteDriver ...@@ -69,14 +69,4 @@ class Driver extends AbstractSQLiteDriver
return $dsn; return $dsn;
} }
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_sqlite';
}
} }
...@@ -88,14 +88,4 @@ class Driver extends AbstractSQLServerDriver ...@@ -88,14 +88,4 @@ class Driver extends AbstractSQLServerDriver
return $connectionOptionsDsn; return $connectionOptionsDsn;
} }
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_sqlsrv';
}
} }
...@@ -47,14 +47,4 @@ class Driver extends AbstractSQLServerDriver ...@@ -47,14 +47,4 @@ class Driver extends AbstractSQLServerDriver
return new SQLSrvConnection($serverName, $driverOptions); return new SQLSrvConnection($serverName, $driverOptions);
} }
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'sqlsrv';
}
} }
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractDB2DriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractDB2DriverTest;
class DB2DriverTest extends AbstractDB2DriverTest class DB2DriverTest extends AbstractDB2DriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('ibm_db2', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new DB2Driver(); return new DB2Driver();
......
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest;
class DriverTest extends AbstractMySQLDriverTest class DriverTest extends AbstractMySQLDriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('mysqli', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new Driver(); return new Driver();
......
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest;
class DriverTest extends AbstractOracleDriverTest class DriverTest extends AbstractOracleDriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('oci8', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new Driver(); return new Driver();
......
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest;
class DriverTest extends AbstractMySQLDriverTest class DriverTest extends AbstractMySQLDriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('pdo_mysql', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new Driver(); return new Driver();
......
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest;
class DriverTest extends AbstractOracleDriverTest class DriverTest extends AbstractOracleDriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('pdo_oracle', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new Driver(); return new Driver();
......
...@@ -4,77 +4,68 @@ namespace Doctrine\DBAL\Tests\Driver\PDOPgSql; ...@@ -4,77 +4,68 @@ namespace Doctrine\DBAL\Tests\Driver\PDOPgSql;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOPgSql\Driver; use Doctrine\DBAL\Driver\PDOPgSql\Driver;
use Doctrine\DBAL\Tests\Driver\AbstractPostgreSQLDriverTest; use Doctrine\DBAL\Tests\Driver\AbstractPostgreSQLDriverTest;
use Doctrine\DBAL\Tests\TestUtil; use Doctrine\DBAL\Tests\TestUtil;
use PDO; use PDO;
use PDOException;
use function array_merge; use function array_merge;
class DriverTest extends AbstractPostgreSQLDriverTest 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 * @group DBAL-920
*/ */
public function testConnectionDisablesPreparesOnPhp56(): void public function testConnectionDisablesPrepares(): void
{ {
$this->skipWhenNotUsingPdoPgsql();
$connection = $this->connect([]); $connection = $this->connect([]);
try { self::assertInstanceOf(PDOConnection::class, $connection);
self::assertTrue($connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)); self::assertTrue(
} catch (PDOException $ignored) { $connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
/** @link https://bugs.php.net/bug.php?id=68371 */ );
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
}
} }
/** /**
* @group DBAL-920 * @group DBAL-920
*/ */
public function testConnectionDoesNotDisablePreparesOnPhp56WhenAttributeDefined(): void public function testConnectionDoesNotDisablePreparesWhenAttributeDefined(): void
{ {
$this->skipWhenNotUsingPdoPgsql();
$connection = $this->connect( $connection = $this->connect(
[PDO::PGSQL_ATTR_DISABLE_PREPARES => false] [PDO::PGSQL_ATTR_DISABLE_PREPARES => false]
); );
try { self::assertInstanceOf(PDOConnection::class, $connection);
self::assertNotSame( self::assertNotTrue(
true, $connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
$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');
}
} }
/** /**
* @group DBAL-920 * @group DBAL-920
*/ */
public function testConnectionDisablePreparesOnPhp56WhenDisablePreparesIsExplicitlyDefined(): void public function testConnectionDisablePreparesWhenDisablePreparesIsExplicitlyDefined(): void
{ {
$this->skipWhenNotUsingPdoPgsql();
$connection = $this->connect( $connection = $this->connect(
[PDO::PGSQL_ATTR_DISABLE_PREPARES => true] [PDO::PGSQL_ATTR_DISABLE_PREPARES => true]
); );
try { self::assertInstanceOf(PDOConnection::class, $connection);
self::assertTrue($connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)); self::assertTrue(
} catch (PDOException $ignored) { $connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
/** @link https://bugs.php.net/bug.php?id=68371 */ );
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
}
} }
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
...@@ -82,15 +73,6 @@ class DriverTest extends AbstractPostgreSQLDriverTest ...@@ -82,15 +73,6 @@ class DriverTest extends AbstractPostgreSQLDriverTest
return new Driver(); 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 * @param array<int,mixed> $driverOptions
*/ */
......
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLiteDriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLiteDriverTest;
class DriverTest extends AbstractSQLiteDriverTest class DriverTest extends AbstractSQLiteDriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('pdo_sqlite', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new Driver(); return new Driver();
......
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest;
class DriverTest extends AbstractSQLServerDriverTest class DriverTest extends AbstractSQLServerDriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('pdo_sqlsrv', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new Driver(); return new Driver();
......
...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest; ...@@ -8,11 +8,6 @@ use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest;
class DriverTest extends AbstractSQLServerDriverTest class DriverTest extends AbstractSQLServerDriverTest
{ {
public function testReturnsName(): void
{
self::assertSame('sqlsrv', $this->driver->getName());
}
protected function createDriver(): DriverInterface protected function createDriver(): DriverInterface
{ {
return new Driver(); 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