You are here

public function ErrorTestController::generateWarnings in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php \Drupal\error_test\Controller\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 47
Contains \Drupal\error_test\Controller\ErrorTestController.

Class

ErrorTestController
Controller routines for error_test routes.

Namespace

Drupal\error_test\Controller

Code

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 [];
}