class DatabaseExceptionWrapperTest

Same name in this branch
  1. 9 core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php \Drupal\Tests\sqlite\Kernel\sqlite\DatabaseExceptionWrapperTest
  2. 9 core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php \Drupal\Tests\mysql\Kernel\mysql\DatabaseExceptionWrapperTest
  3. 9 core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php \Drupal\KernelTests\Core\Database\DatabaseExceptionWrapperTest
Same name and namespace in other branches
  1. 11.x core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php \Drupal\Tests\sqlite\Kernel\sqlite\DatabaseExceptionWrapperTest
  2. 11.x core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php \Drupal\Tests\mysql\Kernel\mysql\DatabaseExceptionWrapperTest
  3. 11.x core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php \Drupal\Tests\pgsql\Kernel\pgsql\DatabaseExceptionWrapperTest
  4. 11.x core/modules/mysqli/tests/src/Kernel/mysqli/DatabaseExceptionWrapperTest.php \Drupal\Tests\mysqli\Kernel\mysqli\DatabaseExceptionWrapperTest
  5. 11.x core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php \Drupal\KernelTests\Core\Database\DatabaseExceptionWrapperTest

Tests exceptions thrown by queries.

@group Database

Hierarchy

Expanded class hierarchy of DatabaseExceptionWrapperTest

File

core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php, line 12

Namespace

Drupal\Tests\pgsql\Kernel\pgsql
View source
class DatabaseExceptionWrapperTest extends DriverSpecificKernelTestBase {
  
  /**
   * Tests Connection::prepareStatement exception on execution.
   */
  public function testPrepareStatementFailOnExecution() {
    $this->expectException(\PDOException::class);
    $stmt = $this->connection
      ->prepareStatement('bananas', []);
    $stmt->execute();
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.