You are here

function error_test_generate_warnings in Drupal 7

Menu callback; generate warnings to test the error handler.

1 string reference to 'error_test_generate_warnings'
error_test_menu in modules/simpletest/tests/error_test.module
Implements hook_menu().

File

modules/simpletest/tests/error_test.module, line 39

Code

function error_test_generate_warnings($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.
  $notice = new \stdClass();
  $notice == 1 ? 1 : 0;

  // This will generate a warning.
  $a = '';
  foreach ($a as $b) {
  }

  // This will generate a user error.
  trigger_error("Drupal is awesome", E_USER_WARNING);
  return "";
}