summaryrefslogtreecommitdiffstats
path: root/tests/lib/DB
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2018-11-06 21:29:20 +0100
committerDaniel Kesselberg <mail@danielkesselberg.de>2018-11-06 21:29:20 +0100
commit04a316aa671a2581fae7780c85af8a3d934ebdec (patch)
tree427f28ccbe833d04ce3c77765ac99f2c2625d91e /tests/lib/DB
parentc92d35a69ad43bb69a16382555326bcfb716dcc1 (diff)
downloadnextcloud-server-04a316aa671a2581fae7780c85af8a3d934ebdec.tar.gz
nextcloud-server-04a316aa671a2581fae7780c85af8a3d934ebdec.zip
Add test that unique constraint is working
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests/lib/DB')
-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);
+ }
+
}