system_test.module

Same filename in other branches
  1. 7.x modules/simpletest/tests/system_test.module
  2. 9 core/modules/system/tests/modules/system_test/system_test.module
  3. 8.9.x core/modules/system/tests/modules/system_test/system_test.module
  4. 10 core/modules/system/tests/modules/system_test/system_test.module

File

core/modules/system/tests/modules/system_test/system_test.module

View source
<?php


/**
 * @file
 * Test module.
 */
declare (strict_types=1);

/**
 * Dummy shutdown function which registers another shutdown function.
 */
function _system_test_first_shutdown_function($arg1, $arg2) {
    // Set something to ensure that this function got called.
    \Drupal::state()->set('_system_test_first_shutdown_function', [
        $arg1,
        $arg2,
    ]);
    drupal_register_shutdown_function('_system_test_second_shutdown_function', $arg1, $arg2);
}

/**
 * Dummy shutdown function.
 */
function _system_test_second_shutdown_function($arg1, $arg2) {
    // Set something to ensure that this function got called.
    \Drupal::state()->set('_system_test_second_shutdown_function', [
        $arg1,
        $arg2,
    ]);
    // Throw an exception with an HTML tag. Since this is called in a shutdown
    // function, it will not bubble up to the default exception handler but will
    // be caught in _drupal_shutdown_function() and be displayed through
    // \Drupal\Core\Utility\Error::renderExceptionSafe() if possible.
    throw new Exception('Drupal is <blink>awesome</blink>.');
}

Functions

Title Deprecated Summary
_system_test_first_shutdown_function Dummy shutdown function which registers another shutdown function.
_system_test_second_shutdown_function Dummy shutdown function.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.