Commit 0458eafe authored by lucasvanlierop's avatar lucasvanlierop

only set deprecated attribute in older php versions so it does not break the test in php 5.6(+)

parent 240b64de
...@@ -36,7 +36,7 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -36,7 +36,7 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
// PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated in php 5.6. PDO::ATTR_EMULATE_PREPARES should // PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated in php 5.6. PDO::ATTR_EMULATE_PREPARES should
// be used instead. so should only it be set when it is supported. // be used instead. so should only it be set when it is supported.
if(defined('PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT')) { if (version_compare('5.6', phpversion()) === 1) {
$this->_conn->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, false); $this->_conn->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, false);
} }
} }
...@@ -67,7 +67,12 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -67,7 +67,12 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
public function testBooleanConversionBoolParamEmulatedPrepares() public function testBooleanConversionBoolParamEmulatedPrepares()
{ {
$this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$this->_conn->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, true);
// PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated in php 5.6. PDO::ATTR_EMULATE_PREPARES should
// be used instead. so should only it be set when it is supported.
if (version_compare('5.6', phpversion()) === 1) {
$this->_conn->getWrappedConnection()->setAttribute(PDO::GSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, true);
}
$platform = $this->_conn->getDatabasePlatform(); $platform = $this->_conn->getDatabasePlatform();
......
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