Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix result cache and PDO connection test on pdo_sqlsrv #2650

Merged
merged 1 commit into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ 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);
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');

parent::tearDown();
}

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