Commit 0bd7781a authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2650 from deeky666/fix-pdo_sqlsrv-tests

Fix result cache and PDO connection test on pdo_sqlsrv
parents b6277715 a5b02c49
...@@ -64,6 +64,10 @@ class PDOConnectionTest extends DbalFunctionalTestCase ...@@ -64,6 +64,10 @@ class PDOConnectionTest extends DbalFunctionalTestCase
*/ */
public function testThrowsWrappedExceptionOnPrepare() public function testThrowsWrappedExceptionOnPrepare()
{ {
if ($this->_conn->getDriver()->getName() === 'pdo_sqlsrv') {
$this->markTestSkipped('pdo_sqlsrv does not allow setting PDO::ATTR_EMULATE_PREPARES at connection level.');
}
// Emulated prepared statements have to be disabled for this test // Emulated prepared statements have to be disabled for this test
// so that PDO actually communicates with the database server to check the query. // so that PDO actually communicates with the database server to check the query.
$this->driverConnection->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false); $this->driverConnection->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
......
...@@ -16,8 +16,6 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -16,8 +16,6 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
{ {
parent::setUp(); parent::setUp();
try {
/* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */
$table = new \Doctrine\DBAL\Schema\Table("caching"); $table = new \Doctrine\DBAL\Schema\Table("caching");
$table->addColumn('test_int', 'integer'); $table->addColumn('test_int', 'integer');
$table->addColumn('test_string', 'string', array('notnull' => false)); $table->addColumn('test_string', 'string', array('notnull' => false));
...@@ -25,10 +23,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -25,10 +23,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sm = $this->_conn->getSchemaManager(); $sm = $this->_conn->getSchemaManager();
$sm->createTable($table); $sm->createTable($table);
} catch(\Exception $e) {
}
$this->_conn->executeUpdate('DELETE FROM caching');
foreach ($this->expectedResult as $row) { foreach ($this->expectedResult as $row) {
$this->_conn->insert('caching', $row); $this->_conn->insert('caching', $row);
} }
...@@ -40,6 +35,13 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -40,6 +35,13 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$config->setResultCacheImpl($cache); $config->setResultCacheImpl($cache);
} }
protected function tearDown()
{
$this->_conn->getSchemaManager()->dropTable('caching');
parent::tearDown();
}
public function testCacheFetchAssoc() public function testCacheFetchAssoc()
{ {
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($this->expectedResult, \PDO::FETCH_ASSOC); $this->assertCacheNonCacheSelectSameFetchModeAreEqual($this->expectedResult, \PDO::FETCH_ASSOC);
......
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