function DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution

Tests Connection::prepareStatement exception on execution.

File

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

Class

DatabaseExceptionWrapperTest
Tests exceptions thrown by queries.

Namespace

Drupal\Tests\pgsql\Kernel\pgsql

Code

public function testPrepareStatementFailOnExecution() : void {
  $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.