diff --git a/UPGRADE.md b/UPGRADE.md
index aae1a14a8f5..dacf919280d 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -1,5 +1,17 @@
# 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.
1. The `$platform` argument of all schema manager constructors is no longer optional.
@@ -307,22 +319,49 @@ Please use other database client applications for import, e.g.:
# Upgrade to 2.11
+## PDO-related classes outside of the PDO namespace are deprecated
+
+The following outside of the PDO namespace have been deprecated in favor of their counterparts in the PDO namespace:
+
+- `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`
+
+## Deprecations in driver-level exception handling
+
+1. The `ExceptionConverterDriver` interface and the usage of the `convertException()` method on the `Driver` objects are deprecated.
+2. The `driverException()` and `driverExceptionDuringQuery()` factory methods of the `DBALException` class are deprecated.
+3. Relying on the wrapper layer handling non-driver exceptions is deprecated.
+
+## `DBALException` factory method deprecations
+
+1. `DBALException::invalidPlatformType()` is deprecated as unused as of v2.7.0.
+2. `DBALException::invalidPdoInstance()` as passing a PDO instance via configuration is deprecated.
+
+## `AbstractPlatform::fixSchemaElementName()` is deprecated.
+
+The method is not used anywhere except for tests.
+
##`ServerInfoAwareConnection::requiresQueryForServerVersion()` is deprecated.
The `ServerInfoAwareConnection::requiresQueryForServerVersion()` method has been deprecated as an implementation detail which is the same for almost all supported drivers.
-## Statement constructors are marked internal
+## Connection and Statement constructors are marked internal
-The driver and wrapper statement objects can be only created by the corresponding connection objects.
+1. Driver connection objects can be only created by the corresponding drivers.
+2. Wrapper connection objects can be only created by the driver manager.
+3. The driver and wrapper connection objects can be only created by the corresponding connection objects.
+
+Additionally, the `SQLSrv\LastInsertId` class has been marked internal.
## The `PingableConnection` interface is deprecated
The wrapper connection will automatically handle the lost connection if the driver supports reporting it.
-## The `ExceptionConverterDriver` interface is deprecated
-
-All drivers will have to implement the exception conversion API.
-
## `DriverException::getErrorCode()` is deprecated
The `DriverException::getErrorCode()` is deprecated as redundant and inconsistently supported by drivers. Use `::getCode()` or `::getSQLState()` instead.
diff --git a/composer.json b/composer.json
index 08d473bcf19..a709a798058 100644
--- a/composer.json
+++ b/composer.json
@@ -37,7 +37,7 @@
"doctrine/event-manager": "^1.0"
},
"require-dev": {
- "doctrine/coding-standard": "^8.0",
+ "doctrine/coding-standard": "^8.1",
"jetbrains/phpstorm-stubs": "^2019.1",
"nikic/php-parser": "^4.4",
"phpstan/phpstan": "^0.12.31",
diff --git a/composer.lock b/composer.lock
index 29462053826..817d8aa1fe7 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "93f2611cd4d28a1389369449c8b5fa5f",
+ "content-hash": "0007c1323fe50966aa611c51b733e37b",
"packages": [
{
"name": "composer/package-versions-deprecated",
@@ -477,22 +477,22 @@
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
- "version": "v0.6.2",
+ "version": "v0.7.0",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
- "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a"
+ "reference": "e8d808670b8f882188368faaf1144448c169c0b7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a",
- "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a",
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7",
+ "reference": "e8d808670b8f882188368faaf1144448c169c0b7",
"shasum": ""
},
"require": {
- "composer-plugin-api": "^1.0",
- "php": "^5.3|^7",
- "squizlabs/php_codesniffer": "^2|^3"
+ "composer-plugin-api": "^1.0 || ^2.0",
+ "php": ">=5.3",
+ "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev"
},
"require-dev": {
"composer/composer": "*",
@@ -539,26 +539,26 @@
"stylecheck",
"tests"
],
- "time": "2020-01-29T20:22:20+00:00"
+ "time": "2020-06-25T14:57:39+00:00"
},
{
"name": "doctrine/coding-standard",
- "version": "8.0.0",
+ "version": "8.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/coding-standard.git",
- "reference": "742200e29fb8ffd58ba9abec8a9ec33db0884677"
+ "reference": "637003febec655f1b27f4301b44bf2264be57434"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/742200e29fb8ffd58ba9abec8a9ec33db0884677",
- "reference": "742200e29fb8ffd58ba9abec8a9ec33db0884677",
+ "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/637003febec655f1b27f4301b44bf2264be57434",
+ "reference": "637003febec655f1b27f4301b44bf2264be57434",
"shasum": ""
},
"require": {
- "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2",
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
"php": "^7.2 || ^8.0",
- "slevomat/coding-standard": "^6.3.8",
+ "slevomat/coding-standard": "^6.3.9",
"squizlabs/php_codesniffer": "^3.5.5"
},
"type": "phpcodesniffer-standard",
@@ -595,7 +595,7 @@
"standard",
"style"
],
- "time": "2020-06-02T17:58:43+00:00"
+ "time": "2020-07-05T20:35:22+00:00"
},
{
"name": "doctrine/instantiator",
diff --git a/psalm.xml b/psalm.xml
index b8f382f9586..a60412e4e5d 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -37,7 +37,7 @@
-
+
@@ -64,7 +64,7 @@
Requires a release of
https://github.com/JetBrains/phpstorm-stubs/pull/732
-->
-
+
diff --git a/src/Connection.php b/src/Connection.php
index 5f4b9382413..8e9fb4d0dc3 100644
--- a/src/Connection.php
+++ b/src/Connection.php
@@ -148,6 +148,8 @@ class Connection implements DriverConnection
/**
* Initializes a new instance of the Connection class.
*
+ * @internal The connection can be only instantiated by the driver manager.
+ *
* @param mixed[] $params The connection parameters.
* @param Driver $driver The driver to use.
* @param Configuration|null $config The configuration, optional.
diff --git a/src/Connections/PrimaryReadReplicaConnection.php b/src/Connections/PrimaryReadReplicaConnection.php
index 4ddb5d6b385..63f657798f0 100644
--- a/src/Connections/PrimaryReadReplicaConnection.php
+++ b/src/Connections/PrimaryReadReplicaConnection.php
@@ -94,6 +94,8 @@ class PrimaryReadReplicaConnection extends Connection
/**
* Creates Primary Replica Connection.
*
+ * @internal The connection can be only instantiated by the driver manager.
+ *
* @param mixed[] $params
*
* @throws InvalidArgumentException
diff --git a/src/DBALException.php b/src/DBALException.php
index 8a45f816f99..af4d7a1ca35 100644
--- a/src/DBALException.php
+++ b/src/DBALException.php
@@ -28,6 +28,9 @@ public static function notSupported($method)
return new self(sprintf("Operation '%s' is not supported by platform.", $method));
}
+ /**
+ * @deprecated Use {@link invalidPlatformType()} instead.
+ */
public static function invalidPlatformSpecified(): self
{
return new self(
@@ -80,6 +83,8 @@ public static function invalidPlatformVersionSpecified($version, $expectedFormat
}
/**
+ * @deprecated Passing a PDO instance in connection parameters is deprecated.
+ *
* @return DBALException
*/
public static function invalidPdoInstance()
diff --git a/src/Driver/IBMDB2/Connection.php b/src/Driver/IBMDB2/Connection.php
index 9bc2d328667..44705615e37 100644
--- a/src/Driver/IBMDB2/Connection.php
+++ b/src/Driver/IBMDB2/Connection.php
@@ -36,6 +36,8 @@ final class Connection implements ServerInfoAwareConnection
private $conn = null;
/**
+ * @internal The connection can be only instantiated by its driver.
+ *
* @param array $driverOptions
*
* @throws Exception
diff --git a/src/Driver/Mysqli/Connection.php b/src/Driver/Mysqli/Connection.php
index d032a0a1997..4caccc9a620 100644
--- a/src/Driver/Mysqli/Connection.php
+++ b/src/Driver/Mysqli/Connection.php
@@ -26,6 +26,8 @@ final class Connection implements ServerInfoAwareConnection
private $conn;
/**
+ * @internal The connection can be only instantiated by its driver.
+ *
* @param iterable $preInitializers
* @param iterable $postInitializers
*
diff --git a/src/Driver/OCI8/Connection.php b/src/Driver/OCI8/Connection.php
index aedd913e8cc..fbf1510bd69 100644
--- a/src/Driver/OCI8/Connection.php
+++ b/src/Driver/OCI8/Connection.php
@@ -37,6 +37,8 @@ final class Connection implements ConnectionInterface, ServerInfoAwareConnection
/**
* Creates a Connection to an Oracle Database using oci8 extension.
*
+ * @internal The connection can be only instantiated by its driver.
+ *
* @param string $username
* @param string $password
* @param string $db
diff --git a/src/Driver/PDO/Connection.php b/src/Driver/PDO/Connection.php
index c643f3ce534..7dc1821ed4e 100644
--- a/src/Driver/PDO/Connection.php
+++ b/src/Driver/PDO/Connection.php
@@ -19,6 +19,8 @@ final class Connection implements ServerInfoAwareConnection
private $connection;
/**
+ * @internal The connection can be only instantiated by its driver.
+ *
* @param string $dsn
* @param string|null $user
* @param string|null $password
diff --git a/src/Driver/PDOMySql/Driver.php b/src/Driver/PDO/MySQL/Driver.php
similarity index 95%
rename from src/Driver/PDOMySql/Driver.php
rename to src/Driver/PDO/MySQL/Driver.php
index a0d7dc9617e..1b52fb8a3dd 100644
--- a/src/Driver/PDOMySql/Driver.php
+++ b/src/Driver/PDO/MySQL/Driver.php
@@ -1,14 +1,11 @@
PDOMySQLDriver::class,
- 'pdo_sqlite' => PDOSQLiteDriver::class,
- 'pdo_pgsql' => PDOPgSQLDriver::class,
- 'pdo_oci' => PDOOCIDriver::class,
- 'oci8' => OCI8Driver::class,
- 'ibm_db2' => IBMDB2Driver::class,
- 'pdo_sqlsrv' => PDOSQLSrvDriver::class,
- 'mysqli' => MySQLiDriver::class,
- 'sqlsrv' => SQLSrvDriver::class,
+ 'pdo_mysql' => PDO\MySQL\Driver::class,
+ 'pdo_sqlite' => PDO\SQLite\Driver::class,
+ 'pdo_pgsql' => PDO\PgSQL\Driver::class,
+ 'pdo_oci' => PDO\OCI\Driver::class,
+ 'oci8' => OCI8\Driver::class,
+ 'ibm_db2' => IBMDB2\Driver::class,
+ 'pdo_sqlsrv' => PDO\SQLSrv\Driver::class,
+ 'mysqli' => Mysqli\Driver::class,
+ 'sqlsrv' => SQLSrv\Driver::class,
];
/**
diff --git a/src/Id/TableGenerator.php b/src/Id/TableGenerator.php
index 6b5a62353a4..cdb7adcbbbc 100644
--- a/src/Id/TableGenerator.php
+++ b/src/Id/TableGenerator.php
@@ -70,7 +70,7 @@ class TableGenerator
*/
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.');
}
diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php
index faec41e1768..b87b1b57d28 100644
--- a/src/Platforms/AbstractPlatform.php
+++ b/src/Platforms/AbstractPlatform.php
@@ -3153,8 +3153,7 @@ public function supportsSchemas()
* Whether this platform can emulate schemas.
*
* Platforms that either support or emulate schemas don't automatically
- * filter a schema for the namespaced elements in {@link
- * AbstractManager#createSchema}.
+ * filter a schema for the namespaced elements in {@link AbstractManager::createSchema()}.
*
* @return bool
*/
@@ -3385,6 +3384,8 @@ public function getSQLResultCasing($column)
* Makes any fixes to a name of a schema element (table, sequence, ...) that are required
* by restrictions of the platform, like a maximum length.
*
+ * @deprecated
+ *
* @param string $schemaElementName
*
* @return string
diff --git a/src/Platforms/OraclePlatform.php b/src/Platforms/OraclePlatform.php
index 2d20a43178e..47c7f1ded70 100644
--- a/src/Platforms/OraclePlatform.php
+++ b/src/Platforms/OraclePlatform.php
@@ -584,6 +584,22 @@ private function normalizeIdentifier($name)
return $identifier->isQuoted() ? $identifier : new Identifier(strtoupper($name));
}
+ /**
+ * Adds suffix to identifier,
+ *
+ * if the new string exceeds max identifier length,
+ * keeps $suffix, cuts from $identifier as much as the part exceeding.
+ */
+ private function addSuffix(string $identifier, string $suffix): string
+ {
+ $maxPossibleLengthWithoutSuffix = $this->getMaxIdentifierLength() - strlen($suffix);
+ if (strlen($identifier) > $maxPossibleLengthWithoutSuffix) {
+ $identifier = substr($identifier, 0, $maxPossibleLengthWithoutSuffix);
+ }
+
+ return $identifier . $suffix;
+ }
+
/**
* Returns the autoincrement primary key identifier name for the given table identifier.
*
@@ -596,7 +612,7 @@ private function normalizeIdentifier($name)
*/
private function getAutoincrementIdentifierName(Identifier $table)
{
- $identifierName = $table->getName() . '_AI_PK';
+ $identifierName = $this->addSuffix($table->getName(), '_AI_PK');
return $table->isQuoted()
? $this->quoteSingleIdentifier($identifierName)
@@ -969,7 +985,7 @@ public function getIdentitySequenceName($tableName, $columnName)
$table = new Identifier($tableName);
// No usage of column name to preserve BC compatibility with <2.5
- $identitySequenceName = $table->getName() . '_SEQ';
+ $identitySequenceName = $this->addSuffix($table->getName(), '_SEQ');
if ($table->isQuoted()) {
$identitySequenceName = '"' . $identitySequenceName . '"';
@@ -1074,6 +1090,8 @@ public function getTimeFormatString()
/**
* {@inheritDoc}
+ *
+ * @deprecated
*/
public function fixSchemaElementName($schemaElementName)
{
diff --git a/src/Platforms/PostgreSQL94Platform.php b/src/Platforms/PostgreSQL94Platform.php
index 99b86070d31..fb29b96ae7f 100644
--- a/src/Platforms/PostgreSQL94Platform.php
+++ b/src/Platforms/PostgreSQL94Platform.php
@@ -648,9 +648,8 @@ public function getAlterTableSQL(TableDiff $diff)
* Checks whether a given column diff is a logically unchanged binary type column.
*
* Used to determine whether a column alteration for a binary type column can be skipped.
- * Doctrine's {@link \Doctrine\DBAL\Types\BinaryType} and {@link \Doctrine\DBAL\Types\BlobType}
- * are mapped to the same database column type on this platform as this platform
- * does not have a native VARBINARY/BINARY column type. Therefore the {@link \Doctrine\DBAL\Schema\Comparator}
+ * Doctrine's {@link BinaryType} and {@link BlobType} are mapped to the same database column type on this platform
+ * as this platform does not have a native VARBINARY/BINARY column type. Therefore the comparator
* might detect differences for binary type columns which do not have to be propagated
* to database as there actually is no difference at database level.
*
diff --git a/src/Query/QueryBuilder.php b/src/Query/QueryBuilder.php
index bd7d0ec9aff..7b712dbb751 100644
--- a/src/Query/QueryBuilder.php
+++ b/src/Query/QueryBuilder.php
@@ -268,7 +268,7 @@ public function getSQL()
*
* @param string|int $key The parameter position or name.
* @param mixed $value The parameter value.
- * @param string|int|null $type One of the {@link \Doctrine\DBAL\ParameterType} constants.
+ * @param string|int|null $type One of the {@link ParameterType} constants.
*
* @return $this This QueryBuilder instance.
*/
diff --git a/src/SQLParserUtils.php b/src/SQLParserUtils.php
index 21ad2f07116..d76098441ec 100644
--- a/src/SQLParserUtils.php
+++ b/src/SQLParserUtils.php
@@ -165,7 +165,7 @@ public static function expandListParameters($query, $params, $types)
array_slice($types, 0, $needle),
$count > 0 ?
// array needles are at {@link \Doctrine\DBAL\ParameterType} constants
- // + {@link Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET}
+ // + {@link \Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET}
array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET) :
[],
array_slice($types, $needle + 1)
diff --git a/src/Types/Type.php b/src/Types/Type.php
index 4cd37c25b6f..df65acc6848 100644
--- a/src/Types/Type.php
+++ b/src/Types/Type.php
@@ -129,13 +129,13 @@ final public static function getTypeRegistry(): TypeRegistry
private static function createTypeRegistry(): TypeRegistry
{
- $registry = new TypeRegistry();
+ $instances = [];
foreach (self::BUILTIN_TYPES_MAP as $name => $class) {
- $registry->register($name, new $class());
+ $instances[$name] = new $class();
}
- return $registry;
+ return new TypeRegistry($instances);
}
/**
@@ -199,7 +199,7 @@ public static function overrideType($name, $className)
* Gets the (preferred) binding type for values of this type that
* can be used when binding parameters to prepared statements.
*
- * This method should return one of the {@link \Doctrine\DBAL\ParameterType} constants.
+ * This method should return one of the {@link ParameterType} constants.
*
* @return int
*/
diff --git a/src/Types/TypeRegistry.php b/src/Types/TypeRegistry.php
index 362a5ccc9a4..4c2e31ecbcf 100644
--- a/src/Types/TypeRegistry.php
+++ b/src/Types/TypeRegistry.php
@@ -18,7 +18,15 @@
final class TypeRegistry
{
/** @var array Map of type names and their corresponding flyweight objects. */
- private $instances = [];
+ private $instances;
+
+ /**
+ * @param array $instances
+ */
+ public function __construct(array $instances = [])
+ {
+ $this->instances = $instances;
+ }
/**
* Finds a type by the given name.
diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php
index a0146693381..7043382765f 100644
--- a/tests/ConnectionTest.php
+++ b/tests/ConnectionTest.php
@@ -110,7 +110,7 @@ public function testGetConfiguration(): 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
diff --git a/tests/Driver/Mysqli/ConnectionTest.php b/tests/Driver/Mysqli/ConnectionTest.php
index 5d976328bab..9c682f006fd 100644
--- a/tests/Driver/Mysqli/ConnectionTest.php
+++ b/tests/Driver/Mysqli/ConnectionTest.php
@@ -6,19 +6,11 @@
use Doctrine\DBAL\Driver\Mysqli\Exception\HostRequired;
use Doctrine\DBAL\Tests\FunctionalTestCase;
-use function extension_loaded;
-
+/**
+ * @requires extension mysqli
+ */
class ConnectionTest extends FunctionalTestCase
{
- protected function setUp(): void
- {
- if (! extension_loaded('mysqli')) {
- self::markTestSkipped('mysqli is not installed.');
- }
-
- parent::setUp();
- }
-
public function testHostnameIsRequiredForPersistentConnection(): void
{
$this->expectException(HostRequired::class);
diff --git a/tests/Driver/PDOMySql/DriverTest.php b/tests/Driver/PDO/MySQL/DriverTest.php
similarity index 74%
rename from tests/Driver/PDOMySql/DriverTest.php
rename to tests/Driver/PDO/MySQL/DriverTest.php
index d97f03a7c30..f059e1e6514 100644
--- a/tests/Driver/PDOMySql/DriverTest.php
+++ b/tests/Driver/PDO/MySQL/DriverTest.php
@@ -1,9 +1,9 @@
connect([]);
- self::assertInstanceOf(PDOConnection::class, $connection);
+ self::assertInstanceOf(PDO\Connection::class, $connection);
self::assertTrue(
- $connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
+ $connection->getWrappedConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES)
);
}
@@ -44,12 +43,12 @@ public function testConnectionDisablesPrepares(): void
public function testConnectionDoesNotDisablePreparesWhenAttributeDefined(): void
{
$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(
- $connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
+ $connection->getWrappedConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES)
);
}
@@ -59,12 +58,12 @@ public function testConnectionDoesNotDisablePreparesWhenAttributeDefined(): void
public function testConnectionDisablePreparesWhenDisablePreparesIsExplicitlyDefined(): void
{
$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(
- $connection->getWrappedConnection()->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES)
+ $connection->getWrappedConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES)
);
}
diff --git a/tests/Driver/PDOSqlsrv/DriverTest.php b/tests/Driver/PDO/SQLSrv/DriverTest.php
similarity index 74%
rename from tests/Driver/PDOSqlsrv/DriverTest.php
rename to tests/Driver/PDO/SQLSrv/DriverTest.php
index dcffafafac3..306ea0d1e0a 100644
--- a/tests/Driver/PDOSqlsrv/DriverTest.php
+++ b/tests/Driver/PDO/SQLSrv/DriverTest.php
@@ -1,9 +1,9 @@
PDOMySQLDriver::class];
+ $options = ['driverClass' => PDO\MySQL\Driver::class];
$conn = DriverManager::getConnection($options);
- self::assertInstanceOf(PDOMySQLDriver::class, $conn->getDriver());
+ self::assertInstanceOf(PDO\MySQL\Driver::class, $conn->getDriver());
}
public function testDatabaseUrlPrimaryReplica(): void
@@ -113,7 +112,7 @@ public function testDatabaseUrlPrimaryReplica(): void
$conn = DriverManager::getConnection($options);
$params = $conn->getParams();
- self::assertInstanceOf(PDOMySQLDriver::class, $conn->getDriver());
+ self::assertInstanceOf(PDO\MySQL\Driver::class, $conn->getDriver());
$expected = [
'user' => 'foo',
@@ -173,7 +172,7 @@ public function databaseUrls(): iterable
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'simple URL with port' => [
@@ -184,49 +183,49 @@ public function databaseUrls(): iterable
'host' => 'localhost',
'port' => 11211,
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'sqlite relative URL with host' => [
'sqlite://localhost/foo/dbname.sqlite',
[
'path' => 'foo/dbname.sqlite',
- 'driver' => PDOSqliteDriver::class,
+ 'driver' => PDO\SQLite\Driver::class,
],
],
'sqlite absolute URL with host' => [
'sqlite://localhost//tmp/dbname.sqlite',
[
'path' => '/tmp/dbname.sqlite',
- 'driver' => PDOSqliteDriver::class,
+ 'driver' => PDO\SQLite\Driver::class,
],
],
'sqlite relative URL without host' => [
'sqlite:///foo/dbname.sqlite',
[
'path' => 'foo/dbname.sqlite',
- 'driver' => PDOSqliteDriver::class,
+ 'driver' => PDO\SQLite\Driver::class,
],
],
'sqlite absolute URL without host' => [
'sqlite:////tmp/dbname.sqlite',
[
'path' => '/tmp/dbname.sqlite',
- 'driver' => PDOSqliteDriver::class,
+ 'driver' => PDO\SQLite\Driver::class,
],
],
'sqlite memory' => [
'sqlite:///:memory:',
[
'memory' => true,
- 'driver' => PDOSqliteDriver::class,
+ 'driver' => PDO\SQLite\Driver::class,
],
],
'sqlite memory with host' => [
'sqlite://localhost/:memory:',
[
'memory' => true,
- 'driver' => PDOSqliteDriver::class,
+ 'driver' => PDO\SQLite\Driver::class,
],
],
'params parsed from URL override individual params' => [
@@ -239,7 +238,7 @@ public function databaseUrls(): iterable
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'params not parsed from URL but individual params are preserved' => [
@@ -253,7 +252,7 @@ public function databaseUrls(): iterable
'host' => 'localhost',
'port' => 1234,
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'query params from URL are used as extra params' => [
@@ -281,7 +280,7 @@ public function databaseUrls(): iterable
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'simple URL with percent encoding' => [
@@ -291,7 +290,7 @@ public function databaseUrls(): iterable
'password' => 'bar/',
'host' => 'localhost',
'dbname' => 'baz+baz@',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'simple URL with percent sign in password' => [
@@ -301,7 +300,7 @@ public function databaseUrls(): iterable
'password' => 'bar%bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
@@ -320,7 +319,7 @@ public function databaseUrls(): iterable
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'URL without scheme but custom driver' => [
@@ -360,7 +359,7 @@ public function databaseUrls(): iterable
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'URL with default custom driver' => [
@@ -373,7 +372,7 @@ public function databaseUrls(): iterable
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
'URL with default driver and default custom driver' => [
@@ -387,7 +386,7 @@ public function databaseUrls(): iterable
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
- 'driver' => PDOMySQLDriver::class,
+ 'driver' => PDO\MySQL\Driver::class,
],
],
];
diff --git a/tests/Functional/BlobTest.php b/tests/Functional/BlobTest.php
index 749bdaeedce..0248b8d9912 100644
--- a/tests/Functional/BlobTest.php
+++ b/tests/Functional/BlobTest.php
@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Tests\Functional;
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\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
@@ -22,7 +22,7 @@ protected function setUp(): void
{
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
// 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');
diff --git a/tests/Functional/Driver/IBMDB2/ConnectionTest.php b/tests/Functional/Driver/IBMDB2/ConnectionTest.php
index 539a2cc7cbf..0157a33f0dd 100644
--- a/tests/Functional/Driver/IBMDB2/ConnectionTest.php
+++ b/tests/Functional/Driver/IBMDB2/ConnectionTest.php
@@ -10,16 +10,14 @@
use ReflectionProperty;
use function db2_close;
-use function extension_loaded;
+/**
+ * @require extension ibm_db2
+ */
class ConnectionTest extends FunctionalTestCase
{
protected function setUp(): void
{
- if (! extension_loaded('ibm_db2')) {
- $this->markTestSkipped('ibm_db2 is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/IBMDB2/DriverTest.php b/tests/Functional/Driver/IBMDB2/DriverTest.php
index 563d3c6a1d8..2a21d9c6a6c 100644
--- a/tests/Functional/Driver/IBMDB2/DriverTest.php
+++ b/tests/Functional/Driver/IBMDB2/DriverTest.php
@@ -6,16 +6,13 @@
use Doctrine\DBAL\Driver\IBMDB2\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
-use function extension_loaded;
-
+/**
+ * @requires extension ibm_db2
+ */
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
- if (! extension_loaded('ibm_db2')) {
- self::markTestSkipped('ibm_db2 is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/IBMDB2/StatementTest.php b/tests/Functional/Driver/IBMDB2/StatementTest.php
index 39b9a4266cf..3cd99a3aff5 100644
--- a/tests/Functional/Driver/IBMDB2/StatementTest.php
+++ b/tests/Functional/Driver/IBMDB2/StatementTest.php
@@ -8,20 +8,17 @@
use Doctrine\DBAL\Driver\IBMDB2\Exception\StatementError;
use Doctrine\DBAL\Tests\FunctionalTestCase;
-use function extension_loaded;
-
use const E_ALL;
use const E_NOTICE;
use const E_WARNING;
+/**
+ * @require extension ibm_db2
+ */
class StatementTest extends FunctionalTestCase
{
protected function setUp(): void
{
- if (! extension_loaded('ibm_db2')) {
- self::markTestSkipped('ibm_db2 is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Functional/Driver/Mysqli/ConnectionTest.php
index b2f5a4b2655..c3d34e32a46 100644
--- a/tests/Functional/Driver/Mysqli/ConnectionTest.php
+++ b/tests/Functional/Driver/Mysqli/ConnectionTest.php
@@ -9,18 +9,16 @@
use Doctrine\DBAL\Tests\TestUtil;
use function array_merge;
-use function extension_loaded;
use const MYSQLI_OPT_CONNECT_TIMEOUT;
+/**
+ * @require extension mysqli
+ */
class ConnectionTest extends FunctionalTestCase
{
protected function setUp(): void
{
- if (! extension_loaded('mysqli')) {
- self::markTestSkipped('mysqli is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/Mysqli/DriverTest.php b/tests/Functional/Driver/Mysqli/DriverTest.php
index 0b3a4834e45..f426a34d7d9 100644
--- a/tests/Functional/Driver/Mysqli/DriverTest.php
+++ b/tests/Functional/Driver/Mysqli/DriverTest.php
@@ -6,16 +6,13 @@
use Doctrine\DBAL\Driver\Mysqli\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
-use function extension_loaded;
-
+/**
+ * @requires extension mysqli
+ */
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
- if (! extension_loaded('mysqli')) {
- self::markTestSkipped('mysqli is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/OCI8/ConnectionTest.php b/tests/Functional/Driver/OCI8/ConnectionTest.php
index 44a1ef634e5..d587e582f90 100644
--- a/tests/Functional/Driver/OCI8/ConnectionTest.php
+++ b/tests/Functional/Driver/OCI8/ConnectionTest.php
@@ -7,8 +7,9 @@
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
-use function extension_loaded;
-
+/**
+ * @requires extension oci8
+ */
class ConnectionTest extends FunctionalTestCase
{
/** @var Connection */
@@ -16,10 +17,6 @@ class ConnectionTest extends FunctionalTestCase
protected function setUp(): void
{
- if (! extension_loaded('oci8')) {
- self::markTestSkipped('oci8 is not installed.');
- }
-
parent::setUp();
if (! $this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/OCI8/DriverTest.php b/tests/Functional/Driver/OCI8/DriverTest.php
index 4d19338f562..5fb7af9089c 100644
--- a/tests/Functional/Driver/OCI8/DriverTest.php
+++ b/tests/Functional/Driver/OCI8/DriverTest.php
@@ -6,16 +6,13 @@
use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
-use function extension_loaded;
-
+/**
+ * @requires extension oci8
+ */
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
- if (! extension_loaded('oci8')) {
- self::markTestSkipped('oci8 is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/OCI8/StatementTest.php b/tests/Functional/Driver/OCI8/StatementTest.php
index 680d272a9d7..6278beb756d 100644
--- a/tests/Functional/Driver/OCI8/StatementTest.php
+++ b/tests/Functional/Driver/OCI8/StatementTest.php
@@ -5,16 +5,13 @@
use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\DBAL\Tests\FunctionalTestCase;
-use function extension_loaded;
-
+/**
+ * @requires extension oci8
+ */
class StatementTest extends FunctionalTestCase
{
protected function setUp(): void
{
- if (! extension_loaded('oci8')) {
- self::markTestSkipped('oci8 is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/PDO/ConnectionTest.php b/tests/Functional/Driver/PDO/ConnectionTest.php
index 46b1298439f..628fa882a1c 100644
--- a/tests/Functional/Driver/PDO/ConnectionTest.php
+++ b/tests/Functional/Driver/PDO/ConnectionTest.php
@@ -2,13 +2,10 @@
namespace Doctrine\DBAL\Tests\Functional\Driver\PDO;
+use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\PDO\Connection;
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 PDO;
use function get_class;
use function sprintf;
@@ -66,7 +63,7 @@ public function testThrowsWrappedExceptionOnPrepare(): void
{
$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.');
}
@@ -74,8 +71,8 @@ public function testThrowsWrappedExceptionOnPrepare(): void
// even though emulated prepared statements are disabled,
// so an exception is thrown only eventually.
if (
- $driver instanceof PDOOracleDriver
- || $driver instanceof PDOPgSQLDriver
+ $driver instanceof PDO\OCI\Driver
+ || $driver instanceof PDO\PgSQL\Driver
) {
self::markTestSkipped(sprintf(
'The underlying implementation of the %s driver does not check the query to be prepared server-side.',
@@ -87,7 +84,7 @@ public function testThrowsWrappedExceptionOnPrepare(): void
// so that PDO actually communicates with the database server to check the query.
$this->driverConnection
->getWrappedConnection()
- ->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ ->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
$this->expectException(Exception::class);
diff --git a/tests/Functional/Driver/PDOMySql/DriverTest.php b/tests/Functional/Driver/PDO/MySQL/DriverTest.php
similarity index 65%
rename from tests/Functional/Driver/PDOMySql/DriverTest.php
rename to tests/Functional/Driver/PDO/MySQL/DriverTest.php
index ca79c242496..8eda92b3107 100644
--- a/tests/Functional/Driver/PDOMySql/DriverTest.php
+++ b/tests/Functional/Driver/PDO/MySQL/DriverTest.php
@@ -1,21 +1,18 @@
connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/PDOOracle/DriverTest.php b/tests/Functional/Driver/PDO/OCI/DriverTest.php
similarity index 76%
rename from tests/Functional/Driver/PDOOracle/DriverTest.php
rename to tests/Functional/Driver/PDO/OCI/DriverTest.php
index 110eeefb3c5..ebaebcf55f0 100644
--- a/tests/Functional/Driver/PDOOracle/DriverTest.php
+++ b/tests/Functional/Driver/PDO/OCI/DriverTest.php
@@ -1,21 +1,18 @@
connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/PDOPgSql/ConnectionTest.php b/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php
similarity index 72%
rename from tests/Functional/Driver/PDOPgSql/ConnectionTest.php
rename to tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php
index 0fa2f551214..6164c7ec907 100644
--- a/tests/Functional/Driver/PDOPgSql/ConnectionTest.php
+++ b/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php
@@ -1,28 +1,25 @@
connection->getDatabasePlatform() instanceof PostgreSQL94Platform) {
+ if ($this->connection->getDriver() instanceof Driver) {
return;
}
- self::markTestSkipped('PDOPgsql only test.');
+ self::markTestSkipped('pdo_pgsql only test.');
}
/**
diff --git a/tests/Functional/Driver/PDOPgSql/DriverTest.php b/tests/Functional/Driver/PDO/PgSQL/DriverTest.php
similarity index 92%
rename from tests/Functional/Driver/PDOPgSql/DriverTest.php
rename to tests/Functional/Driver/PDO/PgSQL/DriverTest.php
index bfa33568934..c8f4f1d6d93 100644
--- a/tests/Functional/Driver/PDOPgSql/DriverTest.php
+++ b/tests/Functional/Driver/PDO/PgSQL/DriverTest.php
@@ -1,26 +1,24 @@
connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/PDOSqlsrv/DriverTest.php b/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php
similarity index 84%
rename from tests/Functional/Driver/PDOSqlsrv/DriverTest.php
rename to tests/Functional/Driver/PDO/SQLSrv/DriverTest.php
index 3bfb68e497f..46aafea22d4 100644
--- a/tests/Functional/Driver/PDOSqlsrv/DriverTest.php
+++ b/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php
@@ -1,25 +1,23 @@
connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/PDOSqlite/DriverTest.php b/tests/Functional/Driver/PDO/SQLite/DriverTest.php
similarity index 71%
rename from tests/Functional/Driver/PDOSqlite/DriverTest.php
rename to tests/Functional/Driver/PDO/SQLite/DriverTest.php
index c6fbf45df58..728a7952dde 100644
--- a/tests/Functional/Driver/PDOSqlite/DriverTest.php
+++ b/tests/Functional/Driver/PDO/SQLite/DriverTest.php
@@ -1,21 +1,18 @@
connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/SQLSrv/DriverTest.php b/tests/Functional/Driver/SQLSrv/DriverTest.php
index 04c6fb14ea9..702e8cabbca 100644
--- a/tests/Functional/Driver/SQLSrv/DriverTest.php
+++ b/tests/Functional/Driver/SQLSrv/DriverTest.php
@@ -6,16 +6,13 @@
use Doctrine\DBAL\Driver\SQLSrv\Driver;
use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest;
-use function extension_loaded;
-
+/**
+ * @requires extension sqlsrv
+ */
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
- if (! extension_loaded('sqlsrv')) {
- self::markTestSkipped('sqlsrv is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Driver/SQLSrv/StatementTest.php b/tests/Functional/Driver/SQLSrv/StatementTest.php
index bf7f914ab1b..f74a9c3969c 100644
--- a/tests/Functional/Driver/SQLSrv/StatementTest.php
+++ b/tests/Functional/Driver/SQLSrv/StatementTest.php
@@ -6,16 +6,13 @@
use Doctrine\DBAL\Driver\SQLSrv\Driver;
use Doctrine\DBAL\Tests\FunctionalTestCase;
-use function extension_loaded;
-
+/**
+ * @requires extension sqlsrv
+ */
class StatementTest extends FunctionalTestCase
{
protected function setUp(): void
{
- if (! extension_loaded('sqlsrv')) {
- self::markTestSkipped('sqlsrv is not installed.');
- }
-
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
diff --git a/tests/Functional/Platform/PlatformRestrictionsTest.php b/tests/Functional/Platform/PlatformRestrictionsTest.php
new file mode 100644
index 00000000000..fcccc388ee5
--- /dev/null
+++ b/tests/Functional/Platform/PlatformRestrictionsTest.php
@@ -0,0 +1,34 @@
+connection->getDatabasePlatform();
+ $tableName = str_repeat('x', $platform->getMaxIdentifierLength());
+ $columnName = str_repeat('y', $platform->getMaxIdentifierLength());
+ $table = new Table($tableName);
+ $table->addColumn($columnName, 'integer', ['autoincrement' => true]);
+ $table->setPrimaryKey([$columnName]);
+ $this->connection->getSchemaManager()->dropAndCreateTable($table);
+ $createdTable = $this->connection->getSchemaManager()->listTableDetails($tableName);
+
+ $this->assertTrue($createdTable->hasColumn($columnName));
+ $this->assertTrue($createdTable->hasPrimaryKey());
+ }
+}
diff --git a/tests/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Functional/Schema/SqliteSchemaManagerTest.php
index 5cb5c8522c3..ea382f38145 100644
--- a/tests/Functional/Schema/SqliteSchemaManagerTest.php
+++ b/tests/Functional/Schema/SqliteSchemaManagerTest.php
@@ -9,12 +9,8 @@
use Doctrine\DBAL\Types\BlobType;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
-use SQLite3;
-use function array_map;
use function dirname;
-use function extension_loaded;
-use function version_compare;
class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
@@ -157,34 +153,6 @@ public function testListTableWithBinary(): void
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
- public function testNonDefaultPKOrder(): void
- {
- if (! extension_loaded('sqlite3')) {
- self::markTestSkipped('This test requires the SQLite3 extension.');
- }
-
- $version = SQLite3::version();
- if (version_compare($version['versionString'], '3.7.16', '<')) {
- self::markTestSkipped('This version of sqlite doesn\'t return the order of the Primary Key.');
- }
-
- $this->connection->exec(<<schemaManager->listTableIndexes('non_default_pk_order');
-
- self::assertCount(1, $tableIndexes);
-
- self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.');
- self::assertEquals(['other_id', 'id'], array_map('strtolower', $tableIndexes['primary']->getColumns()));
- }
-
/**
* @group DBAL-1779
*/
diff --git a/tests/Functional/StatementTest.php b/tests/Functional/StatementTest.php
index 2acdbcdc55f..19bd319fa33 100644
--- a/tests/Functional/StatementTest.php
+++ b/tests/Functional/StatementTest.php
@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Tests\Functional;
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\ParameterType;
use Doctrine\DBAL\Schema\Table;
@@ -27,7 +27,7 @@ protected function setUp(): 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');
}
@@ -50,7 +50,7 @@ public function testStatementIsReusableAfterFreeingResult(): 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()');
}
@@ -87,7 +87,7 @@ public function testReuseStatementWithLongerResults(): 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
// 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');
@@ -153,7 +153,7 @@ public function testIncompletelyFetchedStatementDoesNotBlockConnection(): 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');
}
diff --git a/tests/Functional/TypeConversionTest.php b/tests/Functional/TypeConversionTest.php
index ac2324d2eb8..99111a24915 100644
--- a/tests/Functional/TypeConversionTest.php
+++ b/tests/Functional/TypeConversionTest.php
@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Tests\Functional;
use DateTime;
-use Doctrine\DBAL\Driver\PDOOracle\Driver as PDOOracleDriver;
+use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
use Doctrine\DBAL\Types\Type;
@@ -120,7 +120,7 @@ public static function floatProvider(): iterable
*/
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
// 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');
diff --git a/tests/Functional/Types/BinaryTest.php b/tests/Functional/Types/BinaryTest.php
index dac2c265430..332f318f6a2 100644
--- a/tests/Functional/Types/BinaryTest.php
+++ b/tests/Functional/Types/BinaryTest.php
@@ -5,7 +5,7 @@
namespace Doctrine\DBAL\Tests\Functional\Types;
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\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
@@ -21,7 +21,7 @@ protected function setUp(): void
{
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');
}
diff --git a/tests/Types/TypeRegistryTest.php b/tests/Types/TypeRegistryTest.php
index b8401d60f18..0790c7520ca 100644
--- a/tests/Types/TypeRegistryTest.php
+++ b/tests/Types/TypeRegistryTest.php
@@ -31,9 +31,10 @@ protected function setUp(): void
$this->testType = new BlobType();
$this->otherTestType = new BinaryType();
- $this->registry = new TypeRegistry();
- $this->registry->register(self::TEST_TYPE_NAME, $this->testType);
- $this->registry->register(self::OTHER_TEST_TYPE_NAME, $this->otherTestType);
+ $this->registry = new TypeRegistry([
+ self::TEST_TYPE_NAME => $this->testType,
+ self::OTHER_TEST_TYPE_NAME => $this->otherTestType,
+ ]);
}
public function testGet(): void