Add test that unique constraint is working

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
pull/12329/head
Daniel Kesselberg 8 years ago
parent c92d35a69a
commit 04a316aa67
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
  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