Make WordPress Core


Ignore:
Timestamp:
10/09/2016 01:11:14 AM (10 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/apply_filters.php

    r38571 r38762  
    1212        $callback = array( $a, 'filter' );
    1313        $hook = new WP_Hook();
    14         $tag = rand_str();
     14        $tag = __FUNCTION__;
    1515        $priority = rand( 1, 100 );
    1616        $accepted_args = rand( 1, 100 );
    17         $arg = rand_str();
     17        $arg = __FUNCTION__ . '_arg';
    1818
    1919        $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     
    2929        $callback = array( $a, 'filter' );
    3030        $hook = new WP_Hook();
    31         $tag = rand_str();
     31        $tag = __FUNCTION__;
    3232        $priority = rand( 1, 100 );
    3333        $accepted_args = rand( 1, 100 );
    34         $arg = rand_str();
     34        $arg = __FUNCTION__ . '_arg';
    3535
    3636        $hook->add_filter( $tag, $callback, $priority, $accepted_args );
Note: See TracChangeset for help on using the changeset viewer.