Commit 30258780 authored by Steve Müller's avatar Steve Müller

fix tear down of some test cases

parent a46556fa
...@@ -64,8 +64,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -64,8 +64,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->setUpForeignKeyConstraintViolationExceptionTest(); $this->setUpForeignKeyConstraintViolationExceptionTest();
$this->_conn->insert("constraint_error_table", array('id' => 1)); try {
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); $this->_conn->insert("constraint_error_table", array('id' => 1));
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'); $this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
...@@ -74,6 +80,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -74,6 +80,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
} catch (ForeignKeyConstraintViolationException $exception) { } catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest(); $this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception; throw $exception;
} }
...@@ -88,8 +98,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -88,8 +98,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->setUpForeignKeyConstraintViolationExceptionTest(); $this->setUpForeignKeyConstraintViolationExceptionTest();
$this->_conn->insert("constraint_error_table", array('id' => 1)); try {
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); $this->_conn->insert("constraint_error_table", array('id' => 1));
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'); $this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
...@@ -98,6 +114,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -98,6 +114,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
} catch (ForeignKeyConstraintViolationException $exception) { } catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest(); $this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception; throw $exception;
} }
...@@ -112,8 +132,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -112,8 +132,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->setUpForeignKeyConstraintViolationExceptionTest(); $this->setUpForeignKeyConstraintViolationExceptionTest();
$this->_conn->insert("constraint_error_table", array('id' => 1)); try {
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); $this->_conn->insert("constraint_error_table", array('id' => 1));
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'); $this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
...@@ -122,6 +148,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -122,6 +148,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
} catch (ForeignKeyConstraintViolationException $exception) { } catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest(); $this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception; throw $exception;
} }
...@@ -132,14 +162,20 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -132,14 +162,20 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
{ {
$platform = $this->_conn->getDatabasePlatform(); $platform = $this->_conn->getDatabasePlatform();
if ( ! $platform->supportsForeignKeyConstraints()) { if (!$platform->supportsForeignKeyConstraints()) {
$this->markTestSkipped("Only fails on platforms with foreign key constraints."); $this->markTestSkipped("Only fails on platforms with foreign key constraints.");
} }
$this->setUpForeignKeyConstraintViolationExceptionTest(); $this->setUpForeignKeyConstraintViolationExceptionTest();
$this->_conn->insert("constraint_error_table", array('id' => 1)); try {
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); $this->_conn->insert("constraint_error_table", array('id' => 1));
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'); $this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
...@@ -148,6 +184,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -148,6 +184,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
} catch (ForeignKeyConstraintViolationException $exception) { } catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest(); $this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
} catch (\Exception $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception; throw $exception;
} }
......
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