diff -u b/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php --- b/core/lib/Drupal/Core/Database/Connection.php +++ b/core/lib/Drupal/Core/Database/Connection.php @@ -492,7 +492,7 @@ * An associative array of options to control how the query is run. See * the documentation for DatabaseConnection::defaultOptions() for details. * - * @return Drupal\Core\Database\StatementInterface + * @return \Drupal\Core\Database\StatementInterface * This method will return one of: the executed statement, the number of * rows affected by the query (not the number matched), or the generated * insert ID of the last query, depending on the value of @@ -502,7 +502,7 @@ * $options['throw_exception'] is TRUE. * * @throws PDOException - * @throws Drupal\Core\Database\IntegrityConstraintViolationException + * @throws \Drupal\Core\Database\IntegrityConstraintViolationException */ public function query($query, array $args = array(), $options = array()) { only in patch2: unchanged: --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseExceptionWrapperTest.php @@ -0,0 +1,38 @@ + 'Database exceptiontests', + 'description' => 'Tests exceptions thrown by queries.', + 'group' => 'Database', + ); + } + + function testDatabaseExceptionWrapper() { + $connection = Database::getConnection(); + $query = $connection->prepare('bananas'); + try { + $connection->query($query); + $this->fail('The expected exception is not thrown.'); + } + catch (DatabaseExceptionWrapper $e) { + $this->pass('The expected exception has been thrown.'); + } + } + +}