simpletest.api.php

Same filename in other branches
  1. 7.x modules/simpletest/simpletest.api.php

Hooks provided by the SimpleTest module.

File

core/modules/simpletest/simpletest.api.php

View source
<?php


/**
 * @file
 * Hooks provided by the SimpleTest module.
 */

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Alter the list of tests.
 *
 * This hook will not be invoked by the phpunit tool.
 *
 * @param $groups
 *   A two dimensional array, the first key is the test group, the second is the
 *   name of the test class, and the value is in associative array containing
 *   'name', 'description', 'group', and 'requires' keys.
 *
 * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Convert
 *   your test to a PHPUnit-based one and implement test listeners.
 *
 * @see https://www.drupal.org/node/2939892
 */
function hook_simpletest_alter(&$groups) {
    // An alternative session handler module would not want to run the original
    // Session HTTPS handling test because it checks the sessions table in the
    // database.
    unset($groups['Session']['testHttpsSession']);
}

/**
 * A test group has started.
 *
 * This hook is called just once at the beginning of a test group.
 *
 * This hook is only invoked by the Simpletest UI form runner. It will not be
 * invoked by run-tests.sh or the phpunit tool.
 *
 * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your
 *   test to a PHPUnit-based one and implement test listeners.
 *
 * @see https://www.drupal.org/node/2934242
 */
function hook_test_group_started() {
}

/**
 * A test group has finished.
 *
 * This hook is called just once at the end of a test group.
 *
 * This hook is only invoked by the Simpletest UI form runner. It will not be
 * invoked by run-tests.sh or the phpunit tool.
 *
 * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your
 *   test to a PHPUnit-based one and implement test listeners.
 *
 * @see https://www.drupal.org/node/2934242
 */
function hook_test_group_finished() {
}

/**
 * An individual test has finished.
 *
 * This hook is called when an individual test has finished.
 *
 * This hook is only invoked by the Simpletest UI form runner. It will not be
 * invoked by run-tests.sh or the phpunit tool.
 *
 * @param
 *   $results The results of the test as gathered by
 *   \Drupal\simpletest\WebTestBase.
 *
 * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your
 *   test to a PHPUnit-based one and implement test listeners.
 *
 * @see https://www.drupal.org/node/2934242
 * @see _simpletest_batch_operation()
 */
function hook_test_finished($results) {
}

/**
 * @} End of "addtogroup hooks".
 */

Functions

Title Deprecated Summary
hook_simpletest_alter

in drupal:8.6.0 and is removed from drupal:9.0.0. Convert your test to a PHPUnit-based one and implement test listeners.

Alter the list of tests.
hook_test_finished

in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your test to a PHPUnit-based one and implement test listeners.

An individual test has finished.
hook_test_group_finished

in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your test to a PHPUnit-based one and implement test listeners.

A test group has finished.
hook_test_group_started

in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your test to a PHPUnit-based one and implement test listeners.

A test group has started.

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