Make WordPress Core


Ignore:
Timestamp:
10/09/2016 01:29:04 AM (8 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Continue eliminating randomness in tests.

See [38762]
See #37371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/actions.php

    r38571 r38763  
    1010    function test_simple_action() {
    1111        $a = new MockAction();
    12         $tag = 'test_action';
     12        $tag = __FUNCTION__;
    1313
    1414        add_action($tag, array(&$a, 'action'));
     
    2727    function test_remove_action() {
    2828        $a = new MockAction();
    29         $tag = rand_str();
     29        $tag = __FUNCTION__;
    3030
    3131        add_action($tag, array(&$a, 'action'));
     
    4545
    4646    function test_has_action() {
    47         $tag = rand_str();
    48         $func = rand_str();
     47        $tag = __FUNCTION__;
     48        $func = __FUNCTION__ . '_func';
    4949
    5050        $this->assertFalse( has_action($tag, $func) );
     
    6262        $a1 = new MockAction();
    6363        $a2 = new MockAction();
    64         $tag = rand_str();
     64        $tag = __FUNCTION__;
    6565
    6666        // add both actions to the hook
     
    7777    function test_action_args_1() {
    7878        $a = new MockAction();
    79         $tag = rand_str();
    80         $val = rand_str();
     79        $tag = __FUNCTION__;
     80        $val = __FUNCTION__ . '_val';
    8181
    8282        add_action($tag, array(&$a, 'action'));
     
    9393        $a1 = new MockAction();
    9494        $a2 = new MockAction();
    95         $tag = rand_str();
    96         $val1 = rand_str();
    97         $val2 = rand_str();
     95        $tag = __FUNCTION__;
     96        $val1 = __FUNCTION__ . '_val1';
     97        $val2 = __FUNCTION__ . '_val2';
    9898
    9999        // a1 accepts two arguments, a2 doesn't
     
    126126        $a2 = new MockAction();
    127127        $a3 = new MockAction();
    128         $tag = rand_str();
    129         $val1 = rand_str();
    130         $val2 = rand_str();
     128        $tag = __FUNCTION__;
     129        $val1 = __FUNCTION__ . '_val1';
     130        $val2 = __FUNCTION__ . '_val2';
    131131
    132132        // a1 accepts two arguments, a2 doesn't, a3 accepts two arguments
     
    156156    function test_action_priority() {
    157157        $a = new MockAction();
    158         $tag = rand_str();
     158        $tag = __FUNCTION__;
    159159
    160160        add_action($tag, array(&$a, 'action'), 10);
     
    205205    function test_all_action() {
    206206        $a = new MockAction();
    207         $tag1 = rand_str();
    208         $tag2 = rand_str();
     207        $tag1 = __FUNCTION__ . '_1';
     208        $tag2 = __FUNCTION__ . '_2';
    209209
    210210        // add an 'all' action
     
    229229    function test_remove_all_action() {
    230230        $a = new MockAction();
    231         $tag = rand_str();
     231        $tag = __FUNCTION__;
    232232
    233233        add_action('all', array(&$a, 'action'));
     
    250250        $obj = new stdClass();
    251251        $a = new MockAction();
    252         $tag = rand_str();
     252        $tag = __FUNCTION__;
    253253
    254254        add_action($tag, array(&$a, 'action'));
     
    269269        $a = new MockAction();
    270270
    271         $tag = rand_str();
     271        $tag = __FUNCTION__;
    272272
    273273        add_action($tag, array(&$a, 'action'));
    274274
    275         $context = array( rand_str() => rand_str() );
     275        $context = array( 'key1' => 'val1' );
    276276        do_action($tag, $context);
    277277
     
    279279        $this->assertSame($args[0][0], $context);
    280280
    281         $context2 = array( rand_str() => rand_str(), rand_str() => rand_str() );
     281        $context2 = array( 'key2' => 'val2', 'key3' => 'val3' );
    282282        do_action($tag, $context2);
    283283
     
    301301     */
    302302    function test_action_recursion() {
    303         $tag = rand_str();
     303        $tag = __FUNCTION__;
    304304        $a = new MockAction();
    305305        $b = new MockAction();
     
    328328     */
    329329    function test_action_callback_manipulation_while_running() {
    330         $tag = rand_str();
     330        $tag = __FUNCTION__;
    331331        $a = new MockAction();
    332332        $b = new MockAction();
     
    363363     */
    364364    function test_remove_anonymous_callback() {
    365         $tag = rand_str();
     365        $tag = __FUNCTION__;
    366366        $a = new MockAction();
    367367        add_action( $tag, array( $a, 'action' ), 12, 1 );
     
    397397    function test_array_access_of_wp_filter_global() {
    398398        global $wp_filter;
    399         $tag = rand_str();
     399        $tag = __FUNCTION__;
    400400
    401401        add_action( $tag, '__return_null', 11, 1 );
Note: See TracChangeset for help on using the changeset viewer.