function DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution

Same name in this branch
  1. 11.x core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php \Drupal\Tests\sqlite\Kernel\sqlite\DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution()
  2. 11.x core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php \Drupal\Tests\pgsql\Kernel\pgsql\DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution()
Same name in other branches
  1. 9 core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php \Drupal\Tests\sqlite\Kernel\sqlite\DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution()
  2. 9 core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php \Drupal\Tests\mysql\Kernel\mysql\DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution()
  3. 9 core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php \Drupal\Tests\pgsql\Kernel\pgsql\DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution()
  4. 10 core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php \Drupal\Tests\sqlite\Kernel\sqlite\DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution()
  5. 10 core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php \Drupal\Tests\mysql\Kernel\mysql\DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution()
  6. 10 core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php \Drupal\Tests\pgsql\Kernel\pgsql\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.