Commit b37ff7e9 authored by Benjamin Eberlei's avatar Benjamin Eberlei

A new temporary table test refactoring (if i could reproduce it locally...)

parent 9e757030
...@@ -20,11 +20,11 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -20,11 +20,11 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function tearDown() public function tearDown()
{ {
try { if ($this->_conn) {
$tempTable = $this->_conn->getDatabasePlatform()->getTemporaryTableName("temporary"); try {
$this->_conn->exec($this->_conn->getDatabasePlatform()->getDropTemporaryTableSQL($tempTable)); $tempTable = $this->_conn->getDatabasePlatform()->getTemporaryTableName("temporary");
} catch(\Exception $e) { $this->_conn->exec($this->_conn->getDatabasePlatform()->getDropTemporaryTableSQL($tempTable));
} catch(\Exception $e) { }
} }
} }
...@@ -46,15 +46,11 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -46,15 +46,11 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn("id", "integer"); $table->addColumn("id", "integer");
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
$this->_conn->beginTransaction(); foreach ($platform->getCreateTableSQL($table) AS $sql) {
$this->_conn->getSchemaManager()->createTable($table); $this->_conn->executeQuery($sql);
$this->_conn->commit(); }
$this->_conn->beginTransaction(); $this->_conn->beginTransaction();
$table = $this->_conn->getSchemaManager()->listTableDetails($table->getName());
$this->assertEquals("nontemporary", $table->getName());
$this->_conn->insert("nontemporary", array("id" => 1)); $this->_conn->insert("nontemporary", array("id" => 1));
$this->_conn->exec($platform->getDropTemporaryTableSQL($tempTable)); $this->_conn->exec($platform->getDropTemporaryTableSQL($tempTable));
$this->_conn->insert("nontemporary", array("id" => 2)); $this->_conn->insert("nontemporary", array("id" => 2));
......
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