Add test that unique constraint is working

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2018-11-06 21:29:20 +01:00
parent c92d35a69a
commit 04a316aa67
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
1 changed files with 13 additions and 0 deletions

View File

@ -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);
}
}