Skip to content

Commit

Permalink
fix result cache and PDO connection test on pdo_sqlsrv
Browse files Browse the repository at this point in the history
  • Loading branch information
deeky666 committed Feb 9, 2017
1 parent f5dcc4c commit 1779240
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ public function testThrowsWrappedExceptionOnExec()
*/
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
// 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);

$this->driverConnection->prepare('foo');

Expand Down
24 changes: 13 additions & 11 deletions tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@ protected function setUp()
{
parent::setUp();

try {
/* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */
$table = new \Doctrine\DBAL\Schema\Table("caching");
$table->addColumn('test_int', 'integer');
$table->addColumn('test_string', 'string', array('notnull' => false));
$table->setPrimaryKey(array('test_int'));
$table = new \Doctrine\DBAL\Schema\Table("caching");
$table->addColumn('test_int', 'integer');
$table->addColumn('test_string', 'string', array('notnull' => false));
$table->setPrimaryKey(array('test_int'));

$sm = $this->_conn->getSchemaManager();
$sm->createTable($table);
} catch(\Exception $e) {
$sm = $this->_conn->getSchemaManager();
$sm->createTable($table);

}
$this->_conn->executeUpdate('DELETE FROM caching');
foreach ($this->expectedResult as $row) {
$this->_conn->insert('caching', $row);
}
Expand All @@ -40,6 +35,13 @@ protected function setUp()
$config->setResultCacheImpl($cache);
}

protected function tearDown()
{
$this->_conn->getSchemaManager()->dropTable('caching');

return parent::tearDown();
}

public function testCacheFetchAssoc()
{
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($this->expectedResult, \PDO::FETCH_ASSOC);
Expand Down

0 comments on commit 1779240

Please sign in to comment.