Merge pull request #12329 from nextcloud/feature/noid/test-unique-constraint-violation

Add test that unique constraint is working
This commit is contained in:
Morris Jobke 2018-11-07 16:16:01 +01:00 committed by GitHub
commit 11f8dcb59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}
}