Add test that unique constraint is working
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
parent
c92d35a69a
commit
04a316aa67
1 changed files with 13 additions and 0 deletions
|
@ -336,4 +336,17 @@ class ConnectionTest extends \Test\TestCase {
|
|||
$this->assertEquals(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Doctrine\DBAL\Exception\UniqueConstraintViolationException
|
||||
*/
|
||||
public function testUniqueConstraintViolating() {
|
||||
$this->makeTestTable();
|
||||
|
||||
$testQuery = 'INSERT INTO `*PREFIX*table` (`integerfield`, `textfield`) VALUES(?, ?)';
|
||||
$testParams = [1, 'hello'];
|
||||
|
||||
$this->connection->executeUpdate($testQuery, $testParams);
|
||||
$this->connection->executeUpdate($testQuery, $testParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue