Make WordPress Core


Ignore:
Timestamp:
08/26/2016 08:21:30 PM (7 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Remove many unnecessary calls to rand_str() which can, in theory, fail at random. Static strings are much more appropriate.

See #37371

File:
1 edited

Legend:

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

    r31622 r38382  
    4040    function test_schedule_event_single_args() {
    4141        // schedule an event with arguments and make sure it's returned by wp_next_scheduled
    42         $hook = rand_str();
    43         $timestamp = strtotime('+1 hour');
    44         $args = array(rand_str());
     42        $hook = 'event';
     43        $timestamp = strtotime('+1 hour');
     44        $args = array('foo');
    4545
    4646        wp_schedule_single_event( $timestamp, $hook, $args );
     
    4949        // these don't match so return nothing
    5050        $this->assertEquals( false, wp_next_scheduled($hook) );
    51         $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
     51        $this->assertEquals( false, wp_next_scheduled($hook, array('bar')) );
    5252
    5353        // it's a non recurring event
     
    7070    function test_schedule_event_args() {
    7171        // schedule an event and make sure it's returned by wp_next_scheduled
    72         $hook = rand_str();
     72        $hook = 'event';
    7373        $timestamp = strtotime('+1 hour');
    7474        $recur = 'hourly';
    75         $args = array(rand_str());
     75        $args = array('foo');
    7676
    7777        wp_schedule_event( $timestamp, 'hourly', $hook, $args );
     
    8080        // these don't match so return nothing
    8181        $this->assertEquals( false, wp_next_scheduled($hook) );
    82         $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
     82        $this->assertEquals( false, wp_next_scheduled($hook, array('bar')) );
    8383
    8484        $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
Note: See TracChangeset for help on using the changeset viewer.