diff options
Diffstat (limited to 'modules/simpletest/tests/system_test.module')
-rw-r--r-- | modules/simpletest/tests/system_test.module | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module index 188facc96..bd3eff6c5 100644 --- a/modules/simpletest/tests/system_test.module +++ b/modules/simpletest/tests/system_test.module @@ -48,6 +48,27 @@ function system_test_menu() { 'type' => MENU_CALLBACK, ); + $items['system-test/generate-warnings'] = array( + 'title' => 'Generate warnings', + 'page callback' => 'system_test_generate_warnings', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); + + $items['system-test/trigger-exception'] = array( + 'title' => 'Trigger an exception', + 'page callback' => 'system_test_trigger_exception', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); + + $items['system-test/trigger-pdo-exception'] = array( + 'title' => 'Trigger a PDO exception', + 'page callback' => 'system_test_trigger_pdo_exception', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); + return $items; } @@ -120,3 +141,30 @@ function system_test_modules_uninstalled($modules) { drupal_set_message(t('hook_modules_uninstalled fired for aggregator')); } } + +/** + * Menu callback; generate warnings to test the error handler. + */ +function system_test_generate_warnings() { + // This will generate a notice. + $monkey_love = $bananas; + // This will generate a warning. + $awesomely_big = 1/0; + // This will generate a user error. + trigger_error("Drupal is awesome", E_USER_NOTICE); + return ""; +} + +/** + * Menu callback; trigger an exception to test the exception handler. + */ +function system_test_trigger_exception() { + throw new Exception("Drupal is awesome"); +} + +/** + * Menu callback; trigger an exception to test the exception handler. + */ +function system_test_trigger_pdo_exception() { + db_query("SELECT * FROM bananas_are_awesome"); +} |