Make WordPress Core


Ignore:
Timestamp:
10/09/2016 01:11:14 AM (7 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Begin eliminating unnecessary randomness in tests.

Although unlikely, clashes in randomly generated strings could cause unexpected failures. In addition, most randomness is entirely unnecessary, is bad practice, and increases test time (however small it may be).

See #37371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/hooks/add_filter.php

    r38571 r38762  
    1414        $callback = '__return_null';
    1515        $hook = new WP_Hook();
    16         $tag = rand_str();
     16        $tag = __FUNCTION__;
    1717        $priority = rand( 1, 100 );
    1818        $accepted_args = rand( 1, 100 );
     
    2929        $callback = array( $a, 'action' );
    3030        $hook = new WP_Hook();
    31         $tag = rand_str();
     31        $tag = __FUNCTION__;
    3232        $priority = rand( 1, 100 );
    3333        $accepted_args = rand( 1, 100 );
     
    4343        $callback = array( 'MockAction', 'action' );
    4444        $hook = new WP_Hook();
    45         $tag = rand_str();
     45        $tag = __FUNCTION__;
    4646        $priority = rand( 1, 100 );
    4747        $accepted_args = rand( 1, 100 );
     
    5858        $callback_two = '__return_false';
    5959        $hook = new WP_Hook();
    60         $tag = rand_str();
     60        $tag = __FUNCTION__;
    6161        $priority = rand( 1, 100 );
    6262        $accepted_args = rand( 1, 100 );
     
    7373        $callback_two = '__return_false';
    7474        $hook = new WP_Hook();
    75         $tag = rand_str();
     75        $tag = __FUNCTION__;
    7676        $priority = rand( 1, 100 );
    7777        $accepted_args = rand( 1, 100 );
     
    8888        $callback = '__return_null';
    8989        $hook = new WP_Hook();
    90         $tag = rand_str();
     90        $tag = __FUNCTION__;
    9191        $priority = rand( 1, 100 );
    9292        $accepted_args = rand( 1, 100 );
     
    102102        $callback = '__return_null';
    103103        $hook = new WP_Hook();
    104         $tag = rand_str();
     104        $tag = __FUNCTION__;
    105105        $priority = rand( 1, 100 );
    106106        $accepted_args = rand( 1, 100 );
     
    119119        $c = new MockAction();
    120120        $hook = new WP_Hook();
    121         $tag = rand_str();
     121        $tag = __FUNCTION__;
    122122
    123123        $hook->add_filter( $tag, array( $a, 'action' ), 10, 1 );
Note: See TracChangeset for help on using the changeset viewer.