Commit 2479145c authored by Steve Müller's avatar Steve Müller

fix tear down foreign key constraint violation exception tests

parent dcd0bc66
......@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\DBAL\Schema\Table;
class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
......@@ -67,7 +68,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
try {
$this->_conn->insert('owning_table', array('id' => 2, 'constraint_id' => 2));
} catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
......@@ -84,7 +92,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
try {
$this->_conn->update('constraint_error_table', array('id' => 2), array('id' => 1));
} catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
......@@ -101,7 +116,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
try {
$this->_conn->delete('constraint_error_table', array('id' => 1));
} catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
......@@ -120,7 +142,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1));
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
try {
$this->_conn->executeUpdate($platform->getTruncateTableSQL('constraint_error_table'));
} catch (ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
}
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
......
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