WordPress.org

Make WordPress Core

Changeset 43555


Ignore:
Timestamp:
08/02/2018 10:35:10 PM (16 months ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Add documentation for tests_add_filter(), _test_filter_build_unique_id(), _delete_all_data(), _delete_all_posts().

Props andizer.
Fixes #44703.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/functions.php

    r42724 r43555  
    1717}
    1818
    19 // For adding hooks before loading WP
     19/**
     20 * Adds hooks before loading WP.
     21 *
     22 * @param string       $tag             The name for the filter to add.
     23 * @param object|array $function_to_add The function/callback to execute on call.
     24 * @param int          $priority        The priority.
     25 * @param int          $accepted_args   The amount of accepted arguments.
     26 * @return bool Always true.
     27 */
    2028function tests_add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
    2129    global $wp_filter;
     
    3341}
    3442
     43/**
     44 * Generates a unique function ID based on the given arguments.
     45 *
     46 * @param string       $tag      Unused. The name of the filter to build ID for.
     47 * @param object|array $function The function to generate ID for.
     48 * @param int          $priority Unused. The priority.
     49 * @return string Unique function ID.
     50 */
    3551function _test_filter_build_unique_id( $tag, $function, $priority ) {
    3652    if ( is_string( $function ) ) {
     
    3955
    4056    if ( is_object( $function ) ) {
    41         // Closures are currently implemented as objects
     57        // Closures are currently implemented as objects.
    4258        $function = array( $function, '' );
    4359    } else {
     
    4864        return spl_object_hash( $function[0] ) . $function[1];
    4965    } elseif ( is_string( $function[0] ) ) {
    50         // Static Calling
     66        // Static Calling.
    5167        return $function[0] . $function[1];
    5268    }
    5369}
    5470
     71/**
     72 * Deletes all data from the database.
     73 */
    5574function _delete_all_data() {
    5675    global $wpdb;
     
    8099}
    81100
     101/**
     102 * Deletes all posts from the database.
     103 */
    82104function _delete_all_posts() {
    83105    global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.