Clarify the specific returned driver connection type

parent ad12b393
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\PDOSqlsrv; namespace Doctrine\Tests\DBAL\Functional\Driver\PDOSqlsrv;
use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver; use Doctrine\DBAL\Driver\PDOSqlsrv\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest; use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use Doctrine\Tests\TestUtil; use Doctrine\Tests\TestUtil;
...@@ -40,7 +40,7 @@ class DriverTest extends AbstractDriverTest ...@@ -40,7 +40,7 @@ class DriverTest extends AbstractDriverTest
/** /**
* @param int[]|string[] $driverOptions * @param int[]|string[] $driverOptions
*/ */
protected function getConnection(array $driverOptions) : Connection private function getConnection(array $driverOptions) : PDOConnection
{ {
$params = TestUtil::getConnectionParams(); $params = TestUtil::getConnectionParams();
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Ticket; namespace Doctrine\Tests\DBAL\Functional\Ticket;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use Doctrine\Tests\DbalFunctionalTestCase; use Doctrine\Tests\DbalFunctionalTestCase;
use PDO; use PDO;
...@@ -38,7 +39,7 @@ class DBAL630Test extends DbalFunctionalTestCase ...@@ -38,7 +39,7 @@ class DBAL630Test extends DbalFunctionalTestCase
protected function tearDown() : void protected function tearDown() : void
{ {
if ($this->running) { if ($this->running) {
$this->connection->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $this->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
} }
parent::tearDown(); parent::tearDown();
...@@ -72,7 +73,7 @@ class DBAL630Test extends DbalFunctionalTestCase ...@@ -72,7 +73,7 @@ class DBAL630Test extends DbalFunctionalTestCase
public function testBooleanConversionBoolParamEmulatedPrepares() : void public function testBooleanConversionBoolParamEmulatedPrepares() : void
{ {
$this->connection->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$platform = $this->connection->getDatabasePlatform(); $platform = $this->connection->getDatabasePlatform();
...@@ -96,7 +97,7 @@ class DBAL630Test extends DbalFunctionalTestCase ...@@ -96,7 +97,7 @@ class DBAL630Test extends DbalFunctionalTestCase
?bool $statementValue, ?bool $statementValue,
?bool $databaseConvertedValue ?bool $databaseConvertedValue
) : void { ) : void {
$this->connection->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$platform = $this->connection->getDatabasePlatform(); $platform = $this->connection->getDatabasePlatform();
...@@ -120,7 +121,7 @@ class DBAL630Test extends DbalFunctionalTestCase ...@@ -120,7 +121,7 @@ class DBAL630Test extends DbalFunctionalTestCase
?bool $statementValue, ?bool $statementValue,
bool $databaseConvertedValue bool $databaseConvertedValue
) : void { ) : void {
$this->connection->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$platform = $this->connection->getDatabasePlatform(); $platform = $this->connection->getDatabasePlatform();
...@@ -170,4 +171,12 @@ class DBAL630Test extends DbalFunctionalTestCase ...@@ -170,4 +171,12 @@ class DBAL630Test extends DbalFunctionalTestCase
[null, null], [null, null],
]; ];
} }
private function getWrappedConnection() : PDOConnection
{
$connection = $this->connection->getWrappedConnection();
self::assertInstanceOf(PDOConnection::class, $connection);
return $connection;
}
} }
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