You are here

public function ErrorTestController::triggerPDOException in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php \Drupal\error_test\Controller\ErrorTestController::triggerPDOException()
  2. 9 core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php \Drupal\error_test\Controller\ErrorTestController::triggerPDOException()

Trigger an exception to test the PDO exception handler.

1 string reference to 'ErrorTestController::triggerPDOException'
error_test.routing.yml in core/modules/system/tests/modules/error_test/error_test.routing.yml
core/modules/system/tests/modules/error_test/error_test.routing.yml

File

core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php, line 80

Class

ErrorTestController
Controller routines for error_test routes.

Namespace

Drupal\error_test\Controller

Code

public function triggerPDOException() {
  define('SIMPLETEST_COLLECT_ERRORS', FALSE);
  $this->database
    ->select('bananas_are_awesome', 'b')
    ->fields('b')
    ->execute();
}