function DatabaseExceptionWrapperTest::testPrepareStatementFailOnExecution

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

Class

DatabaseExceptionWrapperTest
Tests exceptions thrown by queries.

Namespace

Drupal\Tests\sqlite\Kernel\sqlite

Code

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.