function DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution

Tests Connection::prepareStatement exception on execution.

File

core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php, line 39

Class

DatabaseExceptionWrapperTest
Tests exceptions thrown by queries.

Namespace

Drupal\Tests\mysql\Kernel\mysql

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.