mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 14:50:29 +00:00
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 git-svn-id: https://develop.svn.wordpress.org/trunk@38382 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -39,16 +39,16 @@ class Tests_Cron extends WP_UnitTestCase {
|
||||
|
||||
function test_schedule_event_single_args() {
|
||||
// schedule an event with arguments and make sure it's returned by wp_next_scheduled
|
||||
$hook = rand_str();
|
||||
$hook = 'event';
|
||||
$timestamp = strtotime('+1 hour');
|
||||
$args = array(rand_str());
|
||||
$args = array('foo');
|
||||
|
||||
wp_schedule_single_event( $timestamp, $hook, $args );
|
||||
// this returns the timestamp only if we provide matching args
|
||||
$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
|
||||
// these don't match so return nothing
|
||||
$this->assertEquals( false, wp_next_scheduled($hook) );
|
||||
$this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
|
||||
$this->assertEquals( false, wp_next_scheduled($hook, array('bar')) );
|
||||
|
||||
// it's a non recurring event
|
||||
$this->assertEquals( '', wp_get_schedule($hook, $args) );
|
||||
@@ -69,17 +69,17 @@ class Tests_Cron extends WP_UnitTestCase {
|
||||
|
||||
function test_schedule_event_args() {
|
||||
// schedule an event and make sure it's returned by wp_next_scheduled
|
||||
$hook = rand_str();
|
||||
$hook = 'event';
|
||||
$timestamp = strtotime('+1 hour');
|
||||
$recur = 'hourly';
|
||||
$args = array(rand_str());
|
||||
$args = array('foo');
|
||||
|
||||
wp_schedule_event( $timestamp, 'hourly', $hook, $args );
|
||||
// this returns the timestamp only if we provide matching args
|
||||
$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
|
||||
// these don't match so return nothing
|
||||
$this->assertEquals( false, wp_next_scheduled($hook) );
|
||||
$this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
|
||||
$this->assertEquals( false, wp_next_scheduled($hook, array('bar')) );
|
||||
|
||||
$this->assertEquals( $recur, wp_get_schedule($hook, $args) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user