From 65ca7ae9461aeb98308f0e05410edeb2bbfba5ad Mon Sep 17 00:00:00 2001 From: greeflas Date: Sat, 8 Aug 2020 00:39:56 +0300 Subject: [PATCH 1/6] Remove slash from const name --- docs/en/reference/transactions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/reference/transactions.rst b/docs/en/reference/transactions.rst index 58ac4a0cb5..602a403b68 100644 --- a/docs/en/reference/transactions.rst +++ b/docs/en/reference/transactions.rst @@ -50,7 +50,7 @@ constants: The default transaction isolation level of a ``Doctrine\DBAL\Connection`` is chosen by the underlying platform -but it is always at least READ\_COMMITTED. +but it is always at least ``READ_COMMITTED``. Transaction Nesting ------------------- From 76564ab8cbc0820b63927cb606fefaf7309a1dc6 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 16 Aug 2020 21:18:53 -0700 Subject: [PATCH 2/6] Add the possibility to specify SSL-related parameters in test configuration --- tests/Doctrine/Tests/TestUtil.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Doctrine/Tests/TestUtil.php b/tests/Doctrine/Tests/TestUtil.php index 54b793129f..28c3d5a714 100644 --- a/tests/Doctrine/Tests/TestUtil.php +++ b/tests/Doctrine/Tests/TestUtil.php @@ -175,6 +175,11 @@ private static function mapConnectionParameters(array $configuration, string $pr 'dbname', 'port', 'server', + 'ssl_key', + 'ssl_cert', + 'ssl_ca', + 'ssl_capath', + 'ssl_cipher', 'unix_socket', ] as $parameter ) { From c88c92670079dc88eefebc7b69d498a71618a5f4 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 16 Aug 2020 20:20:07 -0700 Subject: [PATCH 3/6] Add the possibility to specify driver options in test configuration --- .../DBAL/Functional/Driver/AbstractDriverTest.php | 7 ++++--- .../DBAL/Functional/Driver/Mysqli/ConnectionTest.php | 6 ++++++ .../DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php | 6 ++++++ .../Schema/SchemaManagerFunctionalTestCase.php | 7 ++++--- .../Functional/Schema/SqliteSchemaManagerTest.php | 7 ++++--- tests/Doctrine/Tests/TestUtil.php | 11 +++++++++++ 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php index 27a910e42f..e26b8db28e 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php @@ -28,10 +28,11 @@ public function testConnectsWithoutDatabaseNameParameter(): void $params = $this->connection->getParams(); unset($params['dbname']); - $user = $params['user'] ?? null; - $password = $params['password'] ?? null; + $user = $params['user'] ?? null; + $password = $params['password'] ?? null; + $driverOptions = $params['driverOptions'] ?? []; - $connection = $this->driver->connect($params, $user, $password); + $connection = $this->driver->connect($params, $user, $password, $driverOptions); self::assertInstanceOf(DriverConnection::class, $connection); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php index 20c6064bed..08bf20a742 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php @@ -8,6 +8,8 @@ use Doctrine\Tests\DbalFunctionalTestCase; use Doctrine\Tests\TestUtil; +use function array_merge; + use const MYSQLI_OPT_CONNECT_TIMEOUT; /** @@ -54,6 +56,10 @@ private function getConnection(array $driverOptions): MysqliConnection { $params = TestUtil::getConnectionParams(); + if (isset($params['driverOptions'])) { + $driverOptions = array_merge($params['driverOptions'], $driverOptions); + } + return new MysqliConnection( $params, $params['user'] ?? '', diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php index c8e9c383e6..34ac0cad39 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php @@ -9,6 +9,8 @@ use Doctrine\Tests\TestUtil; use PDO; +use function array_merge; + /** * @requires extension pdo_sqlsrv */ @@ -42,6 +44,10 @@ private function getConnection(array $driverOptions): PDOConnection { $params = TestUtil::getConnectionParams(); + if (isset($params['driverOptions'])) { + $driverOptions = array_merge($params['driverOptions'], $driverOptions); + } + return $this->connection->getDriver()->connect( $params, $params['user'] ?? '', diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index fb02af7270..c8ac120034 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -114,10 +114,11 @@ public function testDropsDatabaseWithActiveConnections(): void $params['dbname'] = 'test_drop_database'; } - $user = $params['user'] ?? null; - $password = $params['password'] ?? null; + $user = $params['user'] ?? null; + $password = $params['password'] ?? null; + $driverOptions = $params['driverOptions'] ?? []; - $connection = $this->connection->getDriver()->connect($params, $user, $password); + $connection = $this->connection->getDriver()->connect($params, $user, $password, $driverOptions); self::assertInstanceOf(Connection::class, $connection); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php index 9e5b57387f..6764b1ed17 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php @@ -43,10 +43,11 @@ public function testDropsDatabaseWithActiveConnections(): void $params = $this->connection->getParams(); $params['dbname'] = 'test_drop_database'; - $user = $params['user'] ?? null; - $password = $params['password'] ?? null; + $user = $params['user'] ?? null; + $password = $params['password'] ?? null; + $driverOptions = $params['driverOptions'] ?? []; - $connection = $this->connection->getDriver()->connect($params, $user, $password); + $connection = $this->connection->getDriver()->connect($params, $user, $password, $driverOptions); self::assertInstanceOf(Connection::class, $connection); diff --git a/tests/Doctrine/Tests/TestUtil.php b/tests/Doctrine/Tests/TestUtil.php index 28c3d5a714..bab3dc9be0 100644 --- a/tests/Doctrine/Tests/TestUtil.php +++ b/tests/Doctrine/Tests/TestUtil.php @@ -8,6 +8,9 @@ use function explode; use function extension_loaded; +use function strlen; +use function strpos; +use function substr; use function unlink; /** @@ -190,6 +193,14 @@ private static function mapConnectionParameters(array $configuration, string $pr $parameters[$parameter] = $configuration[$prefix . $parameter]; } + foreach ($configuration as $param => $value) { + if (strpos($param, $prefix . 'driver_option_') !== 0) { + continue; + } + + $parameters['driverOptions'][substr($param, strlen($prefix . 'driver_option_'))] = $value; + } + return $parameters; } From 9093b7b8cd5bbd43695e75c1a5500c53e63b13a5 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 16 Aug 2020 20:20:32 -0700 Subject: [PATCH 4/6] Test MySQLi connection via TLS on Travis --- .travis.yml | 3 ++ tests/travis/docker-run-mysql-or-mariadb.sh | 8 ++++ tests/travis/mysqli-tls.docker.travis.xml | 44 +++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tests/travis/mysqli-tls.docker.travis.xml diff --git a/.travis.yml b/.travis.yml index 341e475d26..72f3f85c97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -185,6 +185,9 @@ jobs: - stage: Test php: 7.4 env: DB=mysqli.docker IMAGE=mysql:8.0 + - stage: Test + php: 7.4 + env: DB=mysqli-tls.docker IMAGE=mysql:8.0 TLS=yes - stage: Test php: 7.4 env: DB=mariadb.docker IMAGE=mariadb:10.3 diff --git a/tests/travis/docker-run-mysql-or-mariadb.sh b/tests/travis/docker-run-mysql-or-mariadb.sh index a78ce4adb6..de0e53b9fc 100644 --- a/tests/travis/docker-run-mysql-or-mariadb.sh +++ b/tests/travis/docker-run-mysql-or-mariadb.sh @@ -40,3 +40,11 @@ while true; do ;; esac done + +if [[ "$TLS" == "yes" ]] +then + for file in "ca.pem" "client-cert.pem" "client-key.pem" + do + docker cp "rdbms:/var/lib/mysql/$file" . + done +fi diff --git a/tests/travis/mysqli-tls.docker.travis.xml b/tests/travis/mysqli-tls.docker.travis.xml new file mode 100644 index 0000000000..95d6444522 --- /dev/null +++ b/tests/travis/mysqli-tls.docker.travis.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + ../Doctrine/Tests/DBAL + + + + + + ../../lib/Doctrine + + + + + + performance + locking_functional + + + From 7532e41391238368fae3407edcbef596a73872c5 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Tue, 18 Aug 2020 07:29:06 -0700 Subject: [PATCH 5/6] Deprecate the Synchronizer package --- UPGRADE.md | 4 ++++ docs/en/reference/sharding.rst | 4 ++-- .../DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php | 2 ++ lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php | 2 ++ .../DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index a467b387e5..6479312d55 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,9 @@ # Upgrade to 2.11 +## Deprecated `Synchronizer` package + +The `Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer` interface and all its implementations are deprecated. + ## Deprecated usage of wrapper-level components as implementations of driver-level interfaces The usage of the wrapper `Connection` and `Statement` classes as implementations of the `Driver\Connection` and `Driver\Statement` interfaces is deprecated. diff --git a/docs/en/reference/sharding.rst b/docs/en/reference/sharding.rst index 2b2f804da5..8780593a0b 100644 --- a/docs/en/reference/sharding.rst +++ b/docs/en/reference/sharding.rst @@ -269,8 +269,8 @@ you have to sort the data in the application. $sql = "SELECT * FROM customers"; $rows = $shardManager->queryAll($sql, $params); -Schema Operations: SchemaSynchronizer Interface ------------------------------------------------ +Schema Operations: SchemaSynchronizer Interface (deprecated) +------------------------------------------------------------ Schema Operations in a sharding architecture are tricky. You have to perform them on all databases instances (shards) at the same time. Also Doctrine diff --git a/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php b/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php index 9b1974747e..7cfd1f2c00 100644 --- a/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php +++ b/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php @@ -7,6 +7,8 @@ /** * Abstract schema synchronizer with methods for executing batches of SQL. + * + * @deprecated */ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer { diff --git a/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php b/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php index 3e7beea750..a10d3b7f32 100644 --- a/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php +++ b/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php @@ -7,6 +7,8 @@ /** * The synchronizer knows how to synchronize a schema with the configured * database. + * + * @deprecated */ interface SchemaSynchronizer { diff --git a/lib/Doctrine/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php b/lib/Doctrine/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php index 43c0fc6a54..62a5857778 100644 --- a/lib/Doctrine/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php +++ b/lib/Doctrine/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php @@ -12,6 +12,8 @@ /** * Schema Synchronizer for Default DBAL Connection. + * + * @deprecated */ class SingleDatabaseSynchronizer extends AbstractSchemaSynchronizer { From fe834e3ba18536dc079b9b5010cedcb457bb2373 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 19 Aug 2020 10:53:39 -0700 Subject: [PATCH 6/6] Remove test group configuration leftovers --- tests/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml | 7 ------- tests/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml | 7 ------- tests/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml | 7 ------- tests/appveyor/mssql.sql2017.sqlsrv.appveyor.xml | 7 ------- tests/travis/ibm_db2.travis.xml | 7 ------- tests/travis/mariadb.docker.travis.xml | 7 ------- tests/travis/mariadb.mysqli.docker.travis.xml | 7 ------- tests/travis/mysql.docker.travis.xml | 7 ------- tests/travis/mysqli-tls.docker.travis.xml | 7 ------- tests/travis/mysqli.docker.travis.xml | 7 ------- tests/travis/pdo_sqlsrv.travis.xml | 7 ------- tests/travis/pgsql.travis.xml | 7 ------- tests/travis/sqlite.travis.xml | 7 ------- tests/travis/sqlsrv.travis.xml | 7 ------- 14 files changed, 98 deletions(-) diff --git a/tests/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml b/tests/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml index 0b53d9dfff..f9e1c220ec 100644 --- a/tests/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml +++ b/tests/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml b/tests/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml index f2b353ad94..0b06001862 100644 --- a/tests/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml +++ b/tests/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml b/tests/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml index 9b3f53bb24..dcf655bee0 100644 --- a/tests/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml +++ b/tests/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/appveyor/mssql.sql2017.sqlsrv.appveyor.xml b/tests/appveyor/mssql.sql2017.sqlsrv.appveyor.xml index 2f314611ff..bf908ed9b5 100644 --- a/tests/appveyor/mssql.sql2017.sqlsrv.appveyor.xml +++ b/tests/appveyor/mssql.sql2017.sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/ibm_db2.travis.xml b/tests/travis/ibm_db2.travis.xml index 30d3157cc6..3089c56c47 100644 --- a/tests/travis/ibm_db2.travis.xml +++ b/tests/travis/ibm_db2.travis.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/mariadb.docker.travis.xml b/tests/travis/mariadb.docker.travis.xml index 85c681c6f0..67f63b2fde 100644 --- a/tests/travis/mariadb.docker.travis.xml +++ b/tests/travis/mariadb.docker.travis.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/mariadb.mysqli.docker.travis.xml b/tests/travis/mariadb.mysqli.docker.travis.xml index 5c2ed041e3..d93ca5ceda 100644 --- a/tests/travis/mariadb.mysqli.docker.travis.xml +++ b/tests/travis/mariadb.mysqli.docker.travis.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/mysql.docker.travis.xml b/tests/travis/mysql.docker.travis.xml index 85c681c6f0..67f63b2fde 100644 --- a/tests/travis/mysql.docker.travis.xml +++ b/tests/travis/mysql.docker.travis.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/mysqli-tls.docker.travis.xml b/tests/travis/mysqli-tls.docker.travis.xml index a7b2ef6af4..f6f653c42b 100644 --- a/tests/travis/mysqli-tls.docker.travis.xml +++ b/tests/travis/mysqli-tls.docker.travis.xml @@ -34,11 +34,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/mysqli.docker.travis.xml b/tests/travis/mysqli.docker.travis.xml index 5c2ed041e3..d93ca5ceda 100644 --- a/tests/travis/mysqli.docker.travis.xml +++ b/tests/travis/mysqli.docker.travis.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/pdo_sqlsrv.travis.xml b/tests/travis/pdo_sqlsrv.travis.xml index 4b813c1a21..38802c599e 100644 --- a/tests/travis/pdo_sqlsrv.travis.xml +++ b/tests/travis/pdo_sqlsrv.travis.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/pgsql.travis.xml b/tests/travis/pgsql.travis.xml index 2f9042034f..0a1a5c1beb 100644 --- a/tests/travis/pgsql.travis.xml +++ b/tests/travis/pgsql.travis.xml @@ -27,11 +27,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/sqlite.travis.xml b/tests/travis/sqlite.travis.xml index 6eacf80bbc..ce3c1d0f91 100644 --- a/tests/travis/sqlite.travis.xml +++ b/tests/travis/sqlite.travis.xml @@ -22,11 +22,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - - diff --git a/tests/travis/sqlsrv.travis.xml b/tests/travis/sqlsrv.travis.xml index 7004fa993d..de56350ce9 100644 --- a/tests/travis/sqlsrv.travis.xml +++ b/tests/travis/sqlsrv.travis.xml @@ -28,11 +28,4 @@ ../../lib/Doctrine - - - - performance - locking_functional - -