function ErrorTestController::generateWarnings
Generate warnings to test the error handler.
1 string reference to 'ErrorTestController::generateWarnings'
- 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 43  
Class
- ErrorTestController
 - Controller routines for error_test routes.
 
Namespace
Drupal\error_test\ControllerCode
public function generateWarnings($collect_errors = FALSE) {
  // Tell Drupal error reporter to send errors to Simpletest or not.
  define('SIMPLETEST_COLLECT_ERRORS', $collect_errors);
  // This will generate a notice.
  $monkey_love = $bananas;
  // This will generate a warning.
  $awesomely_big = 1 / 0;
  // This will generate a user error. Use & to check for double escaping.
  trigger_error("Drupal & awesome", E_USER_WARNING);
  return [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.