diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index 78bc38023b0..d514557ff79 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -1429,7 +1429,6 @@ public function rollbackSavepoint($savepoint) public function getWrappedConnection() { $this->connect(); - assert($this->_conn instanceof DriverConnection); return $this->_conn; } diff --git a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php index c8684a60498..8e6dc21222b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php @@ -12,6 +12,7 @@ use Doctrine\Tests\DbalFunctionalTestCase; use Error; use Exception; +use PDO; use RuntimeException; use Throwable; use function in_array; @@ -311,4 +312,16 @@ public function testDeterminesDatabasePlatformWhenConnectingToNonExistentDatabas $connection->close(); } + + /** + * @requires extension pdo_sqlite + */ + public function testUserProvidedPDOConnection() : void + { + self::assertTrue( + DriverManager::getConnection([ + 'pdo' => new PDO('sqlite::memory:'), + ])->ping() + ); + } }