Rename classes in Driver\PDO* namespaces

parent 4ec17a7f
# Upgrade to 3.0 # Upgrade to 3.0
## BC BREAK: PDO-based driver classes are moved under the PDO namespace
The following classes have been renamed:
- `PDOMySql\Driver``PDO\MySQL\Driver`
- `PDOOracle\Driver``PDO\OCI\Driver`
- `PDOPgSql\Driver``PDO\PgSQL\Driver`
- `PDOSqlite\Driver``PDO\SQLite\Driver`
- `PDOSqlsrv\Driver``PDO\SQLSrv\Driver`
- `PDOSqlsrv\Connection``PDO\SQLSrv\Connection`
- `PDOSqlsrv\Statement``PDO\SQLSrv\Statement`
## BC BREAK: Changes schema manager instantiation. ## BC BREAK: Changes schema manager instantiation.
1. The `$platform` argument of all schema manager constructors is no longer optional. 1. The `$platform` argument of all schema manager constructors is no longer optional.
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<!-- <!--
Fixing these issues requires an API change Fixing these issues requires an API change
--> -->
<file name="src/Driver/PDOSqlsrv/Connection.php"/> <file name="src/Driver/PDO/SQLSrv/Connection.php"/>
<file name="src/Driver/SQLSrv/Connection.php"/> <file name="src/Driver/SQLSrv/Connection.php"/>
</errorLevel> </errorLevel>
</FalsableReturnStatement> </FalsableReturnStatement>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
Requires a release of Requires a release of
https://github.com/JetBrains/phpstorm-stubs/pull/732 https://github.com/JetBrains/phpstorm-stubs/pull/732
--> -->
<file name="tests/Driver/PDOPgSql/DriverTest.php" /> <file name="tests/Driver/PDO/PgSQL/DriverTest.php" />
</errorLevel> </errorLevel>
</UndefinedConstant> </UndefinedConstant>
<UndefinedClass> <UndefinedClass>
......
<?php <?php
namespace Doctrine\DBAL\Driver\PDOMySql; namespace Doctrine\DBAL\Driver\PDO\MySQL;
use Doctrine\DBAL\Driver\AbstractMySQLDriver; use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Connection;
use PDO; use PDO;
/**
* PDO MySql driver.
*/
final class Driver extends AbstractMySQLDriver final class Driver extends AbstractMySQLDriver
{ {
/** /**
......
<?php <?php
namespace Doctrine\DBAL\Driver\PDOOracle; namespace Doctrine\DBAL\Driver\PDO\OCI;
use Doctrine\DBAL\Driver\AbstractOracleDriver; use Doctrine\DBAL\Driver\AbstractOracleDriver;
use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Connection;
use PDO; use PDO;
/**
* PDO Oracle driver.
*
* WARNING: This driver gives us segfaults in our testsuites on CLOB and other
* stuff. PDO Oracle is not maintained by Oracle or anyone in the PHP community,
* which leads us to the recommendation to use the "oci8" driver to connect
* to Oracle instead.
*/
final class Driver extends AbstractOracleDriver final class Driver extends AbstractOracleDriver
{ {
/** /**
......
<?php <?php
namespace Doctrine\DBAL\Driver\PDOPgSql; namespace Doctrine\DBAL\Driver\PDO\PgSQL;
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver; use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Connection;
...@@ -8,9 +8,6 @@ use PDO; ...@@ -8,9 +8,6 @@ use PDO;
use function defined; use function defined;
/**
* Driver that connects through pdo_pgsql.
*/
final class Driver extends AbstractPostgreSQLDriver final class Driver extends AbstractPostgreSQLDriver
{ {
/** /**
......
<?php <?php
namespace Doctrine\DBAL\Driver\PDOSqlsrv; namespace Doctrine\DBAL\Driver\PDO\SQLSrv;
use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection; use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection;
use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Driver\Result;
......
<?php <?php
namespace Doctrine\DBAL\Driver\PDOSqlsrv; namespace Doctrine\DBAL\Driver\PDO\SQLSrv;
use Doctrine\DBAL\Driver\AbstractSQLServerDriver; use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost; use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost;
...@@ -11,9 +11,6 @@ use PDO; ...@@ -11,9 +11,6 @@ use PDO;
use function is_int; use function is_int;
use function sprintf; use function sprintf;
/**
* The PDO-based Sqlsrv driver.
*/
final class Driver extends AbstractSQLServerDriver final class Driver extends AbstractSQLServerDriver
{ {
/** /**
......
<?php <?php
namespace Doctrine\DBAL\Driver\PDOSqlsrv; namespace Doctrine\DBAL\Driver\PDO\SQLSrv;
use Doctrine\DBAL\Driver\PDO\Statement as PDOStatement; use Doctrine\DBAL\Driver\PDO\Statement as PDOStatement;
use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Driver\Result;
...@@ -8,9 +8,6 @@ use Doctrine\DBAL\Driver\Statement as StatementInterface; ...@@ -8,9 +8,6 @@ use Doctrine\DBAL\Driver\Statement as StatementInterface;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use PDO; use PDO;
/**
* PDO SQL Server Statement
*/
final class Statement implements StatementInterface final class Statement implements StatementInterface
{ {
/** @var PDOStatement */ /** @var PDOStatement */
......
<?php <?php
namespace Doctrine\DBAL\Driver\PDOSqlite; namespace Doctrine\DBAL\Driver\PDO\SQLite;
use Doctrine\DBAL\Driver\AbstractSQLiteDriver; use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Connection;
...@@ -8,9 +8,6 @@ use Doctrine\DBAL\Platforms\SqlitePlatform; ...@@ -8,9 +8,6 @@ use Doctrine\DBAL\Platforms\SqlitePlatform;
use function array_merge; use function array_merge;
/**
* The PDO Sqlite driver.
*/
final class Driver extends AbstractSQLiteDriver final class Driver extends AbstractSQLiteDriver
{ {
/** @var mixed[] */ /** @var mixed[] */
......
...@@ -3,15 +3,11 @@ ...@@ -3,15 +3,11 @@
namespace Doctrine\DBAL; namespace Doctrine\DBAL;
use Doctrine\Common\EventManager; use Doctrine\Common\EventManager;
use Doctrine\DBAL\Driver\IBMDB2\Driver as IBMDB2Driver; use Doctrine\DBAL\Driver\IBMDB2;
use Doctrine\DBAL\Driver\Mysqli\Driver as MySQLiDriver; use Doctrine\DBAL\Driver\Mysqli;
use Doctrine\DBAL\Driver\OCI8\Driver as OCI8Driver; use Doctrine\DBAL\Driver\OCI8;
use Doctrine\DBAL\Driver\PDOMySql\Driver as PDOMySQLDriver; use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\PDOOracle\Driver as PDOOCIDriver; use Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Driver\PDOPgSql\Driver as PDOPgSQLDriver;
use Doctrine\DBAL\Driver\PDOSqlite\Driver as PDOSQLiteDriver;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver as PDOSQLSrvDriver;
use Doctrine\DBAL\Driver\SQLSrv\Driver as SQLSrvDriver;
use function array_keys; use function array_keys;
use function array_map; use function array_map;
...@@ -42,15 +38,15 @@ final class DriverManager ...@@ -42,15 +38,15 @@ final class DriverManager
* @var string[] * @var string[]
*/ */
private static $_driverMap = [ private static $_driverMap = [
'pdo_mysql' => PDOMySQLDriver::class, 'pdo_mysql' => PDO\MySQL\Driver::class,
'pdo_sqlite' => PDOSQLiteDriver::class, 'pdo_sqlite' => PDO\SQLite\Driver::class,
'pdo_pgsql' => PDOPgSQLDriver::class, 'pdo_pgsql' => PDO\PgSQL\Driver::class,
'pdo_oci' => PDOOCIDriver::class, 'pdo_oci' => PDO\OCI\Driver::class,
'oci8' => OCI8Driver::class, 'oci8' => OCI8\Driver::class,
'ibm_db2' => IBMDB2Driver::class, 'ibm_db2' => IBMDB2\Driver::class,
'pdo_sqlsrv' => PDOSQLSrvDriver::class, 'pdo_sqlsrv' => PDO\SQLSrv\Driver::class,
'mysqli' => MySQLiDriver::class, 'mysqli' => Mysqli\Driver::class,
'sqlsrv' => SQLSrvDriver::class, 'sqlsrv' => SQLSrv\Driver::class,
]; ];
/** /**
......
...@@ -70,7 +70,7 @@ class TableGenerator ...@@ -70,7 +70,7 @@ class TableGenerator
*/ */
public function __construct(Connection $conn, $generatorTableName = 'sequences') public function __construct(Connection $conn, $generatorTableName = 'sequences')
{ {
if ($conn->getDriver() instanceof Driver\PDOSqlite\Driver) { if ($conn->getDriver() instanceof Driver\PDO\SQLite\Driver) {
throw new DBALException('Cannot use TableGenerator with SQLite.'); throw new DBALException('Cannot use TableGenerator with SQLite.');
} }
......
...@@ -110,7 +110,7 @@ class ConnectionTest extends TestCase ...@@ -110,7 +110,7 @@ class ConnectionTest extends TestCase
public function testGetDriver(): void public function testGetDriver(): void
{ {
self::assertInstanceOf(\Doctrine\DBAL\Driver\PDOMySql\Driver::class, $this->connection->getDriver()); self::assertInstanceOf(Driver\PDO\MySQL\Driver::class, $this->connection->getDriver());
} }
public function testGetEventManager(): void public function testGetEventManager(): void
......
<?php <?php
namespace Doctrine\DBAL\Tests\Driver\PDOMySql; namespace Doctrine\DBAL\Tests\Driver\PDO\MySQL;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOMySql\Driver; use Doctrine\DBAL\Driver\PDO\MySQL\Driver;
use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest; use Doctrine\DBAL\Tests\Driver\AbstractMySQLDriverTest;
class DriverTest extends AbstractMySQLDriverTest class DriverTest extends AbstractMySQLDriverTest
......
<?php <?php
namespace Doctrine\DBAL\Tests\Driver\PDOOracle; namespace Doctrine\DBAL\Tests\Driver\PDO\OCI;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOOracle\Driver; use Doctrine\DBAL\Driver\PDO\OCI\Driver;
use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest; use Doctrine\DBAL\Tests\Driver\AbstractOracleDriverTest;
class DriverTest extends AbstractOracleDriverTest class DriverTest extends AbstractOracleDriverTest
......
<?php <?php
namespace Doctrine\DBAL\Tests\Driver\PDOPgSql; namespace Doctrine\DBAL\Tests\Driver\PDO\PgSQL;
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\PDO\Connection as PDOConnection; use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\PDOPgSql\Driver; use Doctrine\DBAL\Driver\PDO\PgSQL\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 function array_merge; use function array_merge;
...@@ -32,9 +31,9 @@ class DriverTest extends AbstractPostgreSQLDriverTest ...@@ -32,9 +31,9 @@ class DriverTest extends AbstractPostgreSQLDriverTest
{ {
$connection = $this->connect([]); $connection = $this->connect([]);
self::assertInstanceOf(PDOConnection::class, $connection); self::assertInstanceOf(PDO\Connection::class, $connection);
self::assertTrue( self::assertTrue(
$connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES) $connection->getWrappedConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES)
); );
} }
...@@ -44,12 +43,12 @@ class DriverTest extends AbstractPostgreSQLDriverTest ...@@ -44,12 +43,12 @@ class DriverTest extends AbstractPostgreSQLDriverTest
public function testConnectionDoesNotDisablePreparesWhenAttributeDefined(): void public function testConnectionDoesNotDisablePreparesWhenAttributeDefined(): void
{ {
$connection = $this->connect( $connection = $this->connect(
[PDO::PGSQL_ATTR_DISABLE_PREPARES => false] [\PDO::PGSQL_ATTR_DISABLE_PREPARES => false]
); );
self::assertInstanceOf(PDOConnection::class, $connection); self::assertInstanceOf(PDO\Connection::class, $connection);
self::assertNotTrue( self::assertNotTrue(
$connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES) $connection->getWrappedConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES)
); );
} }
...@@ -59,12 +58,12 @@ class DriverTest extends AbstractPostgreSQLDriverTest ...@@ -59,12 +58,12 @@ class DriverTest extends AbstractPostgreSQLDriverTest
public function testConnectionDisablePreparesWhenDisablePreparesIsExplicitlyDefined(): void public function testConnectionDisablePreparesWhenDisablePreparesIsExplicitlyDefined(): void
{ {
$connection = $this->connect( $connection = $this->connect(
[PDO::PGSQL_ATTR_DISABLE_PREPARES => true] [\PDO::PGSQL_ATTR_DISABLE_PREPARES => true]
); );
self::assertInstanceOf(PDOConnection::class, $connection); self::assertInstanceOf(PDO\Connection::class, $connection);
self::assertTrue( self::assertTrue(
$connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES) $connection->getWrappedConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES)
); );
} }
......
<?php <?php
namespace Doctrine\DBAL\Tests\Driver\PDOSqlsrv; namespace Doctrine\DBAL\Tests\Driver\PDO\SQLSrv;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver; use Doctrine\DBAL\Driver\PDO\SQLSrv\Driver;
use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest; use Doctrine\DBAL\Tests\Driver\AbstractSQLServerDriverTest;
class DriverTest extends AbstractSQLServerDriverTest class DriverTest extends AbstractSQLServerDriverTest
......
<?php <?php
namespace Doctrine\DBAL\Tests\Driver\PDOSqlite; namespace Doctrine\DBAL\Tests\Driver\PDO\SQLite;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOSqlite\Driver; use Doctrine\DBAL\Driver\PDO\SQLite\Driver;
use Doctrine\DBAL\Tests\Driver\AbstractSQLiteDriverTest; use Doctrine\DBAL\Tests\Driver\AbstractSQLiteDriverTest;
class DriverTest extends AbstractSQLiteDriverTest class DriverTest extends AbstractSQLiteDriverTest
......
...@@ -6,8 +6,7 @@ use Doctrine\DBAL\Connection; ...@@ -6,8 +6,7 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection; use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\PDOMySql\Driver as PDOMySQLDriver; use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\PDOSqlite\Driver as PDOSqliteDriver;
use Doctrine\DBAL\Driver\SQLSrv\Driver as SQLSrvDriver; use Doctrine\DBAL\Driver\SQLSrv\Driver as SQLSrvDriver;
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
...@@ -93,10 +92,10 @@ class DriverManagerTest extends TestCase ...@@ -93,10 +92,10 @@ class DriverManagerTest extends TestCase
public function testValidDriverClass(): void public function testValidDriverClass(): void
{ {
$options = ['driverClass' => PDOMySQLDriver::class]; $options = ['driverClass' => PDO\MySQL\Driver::class];
$conn = DriverManager::getConnection($options); $conn = DriverManager::getConnection($options);
self::assertInstanceOf(PDOMySQLDriver::class, $conn->getDriver()); self::assertInstanceOf(PDO\MySQL\Driver::class, $conn->getDriver());
} }
public function testDatabaseUrlPrimaryReplica(): void public function testDatabaseUrlPrimaryReplica(): void
...@@ -113,7 +112,7 @@ class DriverManagerTest extends TestCase ...@@ -113,7 +112,7 @@ class DriverManagerTest extends TestCase
$conn = DriverManager::getConnection($options); $conn = DriverManager::getConnection($options);
$params = $conn->getParams(); $params = $conn->getParams();
self::assertInstanceOf(PDOMySQLDriver::class, $conn->getDriver()); self::assertInstanceOf(PDO\MySQL\Driver::class, $conn->getDriver());
$expected = [ $expected = [
'user' => 'foo', 'user' => 'foo',
...@@ -173,7 +172,7 @@ class DriverManagerTest extends TestCase ...@@ -173,7 +172,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar', 'password' => 'bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'simple URL with port' => [ 'simple URL with port' => [
...@@ -184,49 +183,49 @@ class DriverManagerTest extends TestCase ...@@ -184,49 +183,49 @@ class DriverManagerTest extends TestCase
'host' => 'localhost', 'host' => 'localhost',
'port' => 11211, 'port' => 11211,
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'sqlite relative URL with host' => [ 'sqlite relative URL with host' => [
'sqlite://localhost/foo/dbname.sqlite', 'sqlite://localhost/foo/dbname.sqlite',
[ [
'path' => 'foo/dbname.sqlite', 'path' => 'foo/dbname.sqlite',
'driver' => PDOSqliteDriver::class, 'driver' => PDO\SQLite\Driver::class,
], ],
], ],
'sqlite absolute URL with host' => [ 'sqlite absolute URL with host' => [
'sqlite://localhost//tmp/dbname.sqlite', 'sqlite://localhost//tmp/dbname.sqlite',
[ [
'path' => '/tmp/dbname.sqlite', 'path' => '/tmp/dbname.sqlite',
'driver' => PDOSqliteDriver::class, 'driver' => PDO\SQLite\Driver::class,
], ],
], ],
'sqlite relative URL without host' => [ 'sqlite relative URL without host' => [
'sqlite:///foo/dbname.sqlite', 'sqlite:///foo/dbname.sqlite',
[ [
'path' => 'foo/dbname.sqlite', 'path' => 'foo/dbname.sqlite',
'driver' => PDOSqliteDriver::class, 'driver' => PDO\SQLite\Driver::class,
], ],
], ],
'sqlite absolute URL without host' => [ 'sqlite absolute URL without host' => [
'sqlite:////tmp/dbname.sqlite', 'sqlite:////tmp/dbname.sqlite',
[ [
'path' => '/tmp/dbname.sqlite', 'path' => '/tmp/dbname.sqlite',
'driver' => PDOSqliteDriver::class, 'driver' => PDO\SQLite\Driver::class,
], ],
], ],
'sqlite memory' => [ 'sqlite memory' => [
'sqlite:///:memory:', 'sqlite:///:memory:',
[ [
'memory' => true, 'memory' => true,
'driver' => PDOSqliteDriver::class, 'driver' => PDO\SQLite\Driver::class,
], ],
], ],
'sqlite memory with host' => [ 'sqlite memory with host' => [
'sqlite://localhost/:memory:', 'sqlite://localhost/:memory:',
[ [
'memory' => true, 'memory' => true,
'driver' => PDOSqliteDriver::class, 'driver' => PDO\SQLite\Driver::class,
], ],
], ],
'params parsed from URL override individual params' => [ 'params parsed from URL override individual params' => [
...@@ -239,7 +238,7 @@ class DriverManagerTest extends TestCase ...@@ -239,7 +238,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar', 'password' => 'bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'params not parsed from URL but individual params are preserved' => [ 'params not parsed from URL but individual params are preserved' => [
...@@ -253,7 +252,7 @@ class DriverManagerTest extends TestCase ...@@ -253,7 +252,7 @@ class DriverManagerTest extends TestCase
'host' => 'localhost', 'host' => 'localhost',
'port' => 1234, 'port' => 1234,
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'query params from URL are used as extra params' => [ 'query params from URL are used as extra params' => [
...@@ -281,7 +280,7 @@ class DriverManagerTest extends TestCase ...@@ -281,7 +280,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar', 'password' => 'bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'simple URL with percent encoding' => [ 'simple URL with percent encoding' => [
...@@ -291,7 +290,7 @@ class DriverManagerTest extends TestCase ...@@ -291,7 +290,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar/', 'password' => 'bar/',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz+baz@', 'dbname' => 'baz+baz@',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'simple URL with percent sign in password' => [ 'simple URL with percent sign in password' => [
...@@ -301,7 +300,7 @@ class DriverManagerTest extends TestCase ...@@ -301,7 +300,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar%bar', 'password' => 'bar%bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
...@@ -320,7 +319,7 @@ class DriverManagerTest extends TestCase ...@@ -320,7 +319,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar', 'password' => 'bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'URL without scheme but custom driver' => [ 'URL without scheme but custom driver' => [
...@@ -360,7 +359,7 @@ class DriverManagerTest extends TestCase ...@@ -360,7 +359,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar', 'password' => 'bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'URL with default custom driver' => [ 'URL with default custom driver' => [
...@@ -373,7 +372,7 @@ class DriverManagerTest extends TestCase ...@@ -373,7 +372,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar', 'password' => 'bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
'URL with default driver and default custom driver' => [ 'URL with default driver and default custom driver' => [
...@@ -387,7 +386,7 @@ class DriverManagerTest extends TestCase ...@@ -387,7 +386,7 @@ class DriverManagerTest extends TestCase
'password' => 'bar', 'password' => 'bar',
'host' => 'localhost', 'host' => 'localhost',
'dbname' => 'baz', 'dbname' => 'baz',
'driver' => PDOMySQLDriver::class, 'driver' => PDO\MySQL\Driver::class,
], ],
], ],
]; ];
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Tests\Functional; namespace Doctrine\DBAL\Tests\Functional;
use Doctrine\DBAL\Driver\OCI8\Driver as OCI8Driver; use Doctrine\DBAL\Driver\OCI8\Driver as OCI8Driver;
use Doctrine\DBAL\Driver\PDOOracle\Driver as PDOOracleDriver; use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\FunctionalTestCase;
...@@ -22,7 +22,7 @@ class BlobTest extends FunctionalTestCase ...@@ -22,7 +22,7 @@ class BlobTest extends FunctionalTestCase
{ {
parent::setUp(); parent::setUp();
if ($this->connection->getDriver() instanceof PDOOracleDriver) { if ($this->connection->getDriver() instanceof PDO\OCI\Driver) {
// inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported // inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported
// see http://php.net/manual/en/pdo.lobs.php#example-1035 // see http://php.net/manual/en/pdo.lobs.php#example-1035
self::markTestSkipped('DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI'); self::markTestSkipped('DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI');
......
...@@ -2,13 +2,10 @@ ...@@ -2,13 +2,10 @@
namespace Doctrine\DBAL\Tests\Functional\Driver\PDO; namespace Doctrine\DBAL\Tests\Functional\Driver\PDO;
use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Connection;
use Doctrine\DBAL\Driver\PDO\Exception; use Doctrine\DBAL\Driver\PDO\Exception;
use Doctrine\DBAL\Driver\PDOOracle\Driver as PDOOracleDriver;
use Doctrine\DBAL\Driver\PDOPgSql\Driver as PDOPgSQLDriver;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver as PDOSQLSRVDriver;
use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\FunctionalTestCase;
use PDO;
use function get_class; use function get_class;
use function sprintf; use function sprintf;
...@@ -66,7 +63,7 @@ class ConnectionTest extends FunctionalTestCase ...@@ -66,7 +63,7 @@ class ConnectionTest extends FunctionalTestCase
{ {
$driver = $this->connection->getDriver(); $driver = $this->connection->getDriver();
if ($driver instanceof PDOSQLSRVDriver) { if ($driver instanceof PDO\SQLSrv\Driver) {
self::markTestSkipped('pdo_sqlsrv does not allow setting PDO::ATTR_EMULATE_PREPARES at connection level.'); self::markTestSkipped('pdo_sqlsrv does not allow setting PDO::ATTR_EMULATE_PREPARES at connection level.');
} }
...@@ -74,8 +71,8 @@ class ConnectionTest extends FunctionalTestCase ...@@ -74,8 +71,8 @@ class ConnectionTest extends FunctionalTestCase
// even though emulated prepared statements are disabled, // even though emulated prepared statements are disabled,
// so an exception is thrown only eventually. // so an exception is thrown only eventually.
if ( if (
$driver instanceof PDOOracleDriver $driver instanceof PDO\OCI\Driver
|| $driver instanceof PDOPgSQLDriver || $driver instanceof PDO\PgSQL\Driver
) { ) {
self::markTestSkipped(sprintf( self::markTestSkipped(sprintf(
'The underlying implementation of the %s driver does not check the query to be prepared server-side.', 'The underlying implementation of the %s driver does not check the query to be prepared server-side.',
...@@ -87,7 +84,7 @@ class ConnectionTest extends FunctionalTestCase ...@@ -87,7 +84,7 @@ class ConnectionTest extends FunctionalTestCase
// so that PDO actually communicates with the database server to check the query. // so that PDO actually communicates with the database server to check the query.
$this->driverConnection $this->driverConnection
->getWrappedConnection() ->getWrappedConnection()
->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); ->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
$this->expectException(Exception::class); $this->expectException(Exception::class);
......
<?php <?php
namespace Doctrine\DBAL\Tests\Functional\Driver\PDOMySql; namespace Doctrine\DBAL\Tests\Functional\Driver\PDO\MySQL;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOMySql\Driver; use Doctrine\DBAL\Driver\PDO\MySQL\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
use function extension_loaded; use function extension_loaded;
......
<?php <?php
namespace Doctrine\DBAL\Tests\Functional\Driver\PDOOracle; namespace Doctrine\DBAL\Tests\Functional\Driver\PDO\OCI;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOOracle\Driver; use Doctrine\DBAL\Driver\PDO\OCI\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
use function extension_loaded; use function extension_loaded;
......
<?php <?php
namespace Doctrine\DBAL\Tests\Functional\Driver\PDOPgSql; namespace Doctrine\DBAL\Tests\Functional\Driver\PDO\PgSQL;
use Doctrine\DBAL\Driver\PDO\PgSQL\Driver;
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\FunctionalTestCase;
use function extension_loaded; use function extension_loaded;
...@@ -18,11 +18,11 @@ class ConnectionTest extends FunctionalTestCase ...@@ -18,11 +18,11 @@ class ConnectionTest extends FunctionalTestCase
parent::setUp(); parent::setUp();
if ($this->connection->getDatabasePlatform() instanceof PostgreSQL94Platform) { if ($this->connection->getDriver() instanceof Driver) {
return; return;
} }
self::markTestSkipped('PDOPgsql only test.'); self::markTestSkipped('pdo_pgsql only test.');
} }
/** /**
......
<?php <?php
namespace Doctrine\DBAL\Tests\Functional\Driver\PDOPgSql; namespace Doctrine\DBAL\Tests\Functional\Driver\PDO\PgSQL;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOPgSql\Driver; use Doctrine\DBAL\Driver\PDO\PgSQL\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
use Doctrine\DBAL\Tests\TestUtil; use Doctrine\DBAL\Tests\TestUtil;
......
<?php <?php
namespace Doctrine\DBAL\Tests\Functional\Driver\PDOSqlsrv; namespace Doctrine\DBAL\Tests\Functional\Driver\PDO\SQLSrv;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOSqlsrv\Connection; use Doctrine\DBAL\Driver\PDO\SQLSrv\Connection;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver; use Doctrine\DBAL\Driver\PDO\SQLSrv\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
use Doctrine\DBAL\Tests\TestUtil; use Doctrine\DBAL\Tests\TestUtil;
use PDO; use PDO;
......
<?php <?php
namespace Doctrine\DBAL\Tests\Functional\Driver\PDOSqlite; namespace Doctrine\DBAL\Tests\Functional\Driver\PDO\SQLite;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOSqlite\Driver; use Doctrine\DBAL\Driver\PDO\SQLite\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
use function extension_loaded; use function extension_loaded;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Tests\Functional; namespace Doctrine\DBAL\Tests\Functional;
use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Driver\PDOOracle\Driver as PDOOracleDriver; use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
...@@ -27,7 +27,7 @@ class StatementTest extends FunctionalTestCase ...@@ -27,7 +27,7 @@ class StatementTest extends FunctionalTestCase
public function testStatementIsReusableAfterFreeingResult(): void public function testStatementIsReusableAfterFreeingResult(): void
{ {
if ($this->connection->getDriver() instanceof PDOOracleDriver) { if ($this->connection->getDriver() instanceof PDO\OCI\Driver) {
self::markTestIncomplete('See https://bugs.php.net/bug.php?id=77181'); self::markTestIncomplete('See https://bugs.php.net/bug.php?id=77181');
} }
...@@ -50,7 +50,7 @@ class StatementTest extends FunctionalTestCase ...@@ -50,7 +50,7 @@ class StatementTest extends FunctionalTestCase
public function testReuseStatementWithLongerResults(): void public function testReuseStatementWithLongerResults(): void
{ {
if ($this->connection->getDriver() instanceof PDOOracleDriver) { if ($this->connection->getDriver() instanceof PDO\OCI\Driver) {
self::markTestIncomplete('PDO_OCI doesn\'t support fetching blobs via PDOStatement::fetchAll()'); self::markTestIncomplete('PDO_OCI doesn\'t support fetching blobs via PDOStatement::fetchAll()');
} }
...@@ -87,7 +87,7 @@ class StatementTest extends FunctionalTestCase ...@@ -87,7 +87,7 @@ class StatementTest extends FunctionalTestCase
public function testFetchLongBlob(): void public function testFetchLongBlob(): void
{ {
if ($this->connection->getDriver() instanceof PDOOracleDriver) { if ($this->connection->getDriver() instanceof PDO\OCI\Driver) {
// inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported // inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported
// see http://php.net/manual/en/pdo.lobs.php#example-1035 // see http://php.net/manual/en/pdo.lobs.php#example-1035
self::markTestSkipped('DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI'); self::markTestSkipped('DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI');
...@@ -153,7 +153,7 @@ EOF ...@@ -153,7 +153,7 @@ EOF
public function testReuseStatementAfterFreeingResult(): void public function testReuseStatementAfterFreeingResult(): void
{ {
if ($this->connection->getDriver() instanceof PDOOracleDriver) { if ($this->connection->getDriver() instanceof PDO\OCI\Driver) {
self::markTestIncomplete('See https://bugs.php.net/bug.php?id=77181'); self::markTestIncomplete('See https://bugs.php.net/bug.php?id=77181');
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Tests\Functional; namespace Doctrine\DBAL\Tests\Functional;
use DateTime; use DateTime;
use Doctrine\DBAL\Driver\PDOOracle\Driver as PDOOracleDriver; use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\FunctionalTestCase;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
...@@ -120,7 +120,7 @@ class TypeConversionTest extends FunctionalTestCase ...@@ -120,7 +120,7 @@ class TypeConversionTest extends FunctionalTestCase
*/ */
public function testIdempotentConversionToString(string $type, $originalValue): void public function testIdempotentConversionToString(string $type, $originalValue): void
{ {
if ($type === 'text' && $this->connection->getDriver() instanceof PDOOracleDriver) { if ($type === 'text' && $this->connection->getDriver() instanceof PDO\OCI\Driver) {
// inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported // inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported
// see http://php.net/manual/en/pdo.lobs.php#example-1035 // see http://php.net/manual/en/pdo.lobs.php#example-1035
self::markTestSkipped('DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI'); self::markTestSkipped('DBAL doesn\'t support storing LOBs represented as streams using PDO_OCI');
......
...@@ -5,7 +5,7 @@ declare(strict_types=1); ...@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\DBAL\Tests\Functional\Types; namespace Doctrine\DBAL\Tests\Functional\Types;
use Doctrine\DBAL\Driver\IBMDB2\Driver; use Doctrine\DBAL\Driver\IBMDB2\Driver;
use Doctrine\DBAL\Driver\PDOOracle\Driver as PDOOracleDriver; use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\FunctionalTestCase;
...@@ -21,7 +21,7 @@ class BinaryTest extends FunctionalTestCase ...@@ -21,7 +21,7 @@ class BinaryTest extends FunctionalTestCase
{ {
parent::setUp(); parent::setUp();
if ($this->connection->getDriver() instanceof PDOOracleDriver) { if ($this->connection->getDriver() instanceof PDO\OCI\Driver) {
self::markTestSkipped('PDO_OCI doesn\'t support binding binary values'); self::markTestSkipped('PDO_OCI doesn\'t support binding binary values');
} }
......
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