summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-11-07 16:16:01 +0100
committerGitHub <noreply@github.com>2018-11-07 16:16:01 +0100
commit11f8dcb59caf336536fb908510e2955a5ae0eae8 (patch)
tree50ca1f39920a8d547c58a60cfc76d0f635e3e4a3 /tests
parent9eb5ab9e7072c75687c361791e332b4b2e348b6e (diff)
parent04a316aa671a2581fae7780c85af8a3d934ebdec (diff)
downloadnextcloud-server-11f8dcb59caf336536fb908510e2955a5ae0eae8.tar.gz
nextcloud-server-11f8dcb59caf336536fb908510e2955a5ae0eae8.zip
Merge pull request #12329 from nextcloud/feature/noid/test-unique-constraint-violation
Add test that unique constraint is working
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/DB/ConnectionTest.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/lib/DB/ConnectionTest.php b/tests/lib/DB/ConnectionTest.php
index 62b168fbb53..857bb3cd79f 100644
--- a/tests/lib/DB/ConnectionTest.php
+++ b/tests/lib/DB/ConnectionTest.php
@@ -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);
+ }
+
}