Make WordPress Core

Ticket #44703: 44703.diff

File 44703.diff, 2.1 KB (added by andizer, 8 years ago)
  • tests/phpunit/includes/functions.php

     
    1616        unset( $_SERVER['HTTPS'] );
    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 *
     27 * @return bool Always true.
     28 */
    2029function tests_add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
    2130        global $wp_filter;
    2231
     
    3241        return true;
    3342}
    3443
     44/**
     45 * Generates an unique id based on the given arguments.
     46 *
     47 * @param string       $tag      Unused. The name of the filter to build id for.
     48 * @param Object|array $function The function to generate id for.
     49 * @param int          $priority Unused. The priority.
     50 *
     51 * @return array|string
     52 */
    3553function _test_filter_build_unique_id( $tag, $function, $priority ) {
    3654        if ( is_string( $function ) ) {
    3755                return $function;
     
    3856        }
    3957
    4058        if ( is_object( $function ) ) {
    41                 // Closures are currently implemented as objects
     59                // Closures are currently implemented as objects.
    4260                $function = array( $function, '' );
    4361        } else {
    4462                $function = (array) $function;
     
    4765        if ( is_object( $function[0] ) ) {
    4866                return spl_object_hash( $function[0] ) . $function[1];
    4967        } elseif ( is_string( $function[0] ) ) {
    50                 // Static Calling
     68                // Static Calling.
    5169                return $function[0] . $function[1];
    5270        }
    5371}
    5472
     73/**
     74 * Deletes all data from the database
     75 *
     76 * @return void
     77 */
    5578function _delete_all_data() {
    5679        global $wpdb;
    5780
     
    79102        $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id != 1" );
    80103}
    81104
     105/**
     106 * Deletes all the posts from the database.
     107 *
     108 * @return void
     109 */
    82110function _delete_all_posts() {
    83111        global $wpdb;
    84112