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

Add test that unique constraint is working
pull/12316/head
Morris Jobke 8 years ago committed by GitHub
commit 11f8dcb59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      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);
}
}

Loading…
Cancel
Save