Build/Test Tools: Remove commented out tests that have existed in an unimplemented state since the dawn of the test infrastructure.
See #38716 git-svn-id: https://develop.svn.wordpress.org/trunk@39554 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7b7914a99f
commit
d06bd0172e
@ -249,81 +249,3 @@ class Tests_Cron extends WP_UnitTestCase {
|
||||
$this->assertEquals( $ts2, wp_next_scheduled( $hook, $args ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable the WP Cron running test for the moment as it kills the whole test suite.
|
||||
* TODO - Fix it to work with the new cron implementation in trunk
|
||||
*
|
||||
class WPTestCronRunning extends _WPEmptyBlog {
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
// make sure the schedule is clear
|
||||
_set_cron_array(array());
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
parent::tearDown();
|
||||
// make sure the schedule is clear
|
||||
_set_cron_array(array());
|
||||
}
|
||||
function _do_cron() {
|
||||
// FIXME: wp-cron.php is difficult to test, could be wrapped in a function
|
||||
$_GET['check'] = wp_hash('187425');
|
||||
require(ABSPATH.'/wp-cron.php');
|
||||
}
|
||||
|
||||
function test_run_schedule_single() {
|
||||
// schedule an event, run it, and make sure the hook is called
|
||||
$hook = __FUNCTION__;
|
||||
$args = array(rand_str());
|
||||
$timestamp = strtotime('-1 second');
|
||||
|
||||
// register a test action
|
||||
$a = new MockAction();
|
||||
add_action($hook, array(&$a, 'action'));
|
||||
|
||||
// schedule an event for 1 second ago
|
||||
wp_schedule_single_event( $timestamp, $hook, $args );
|
||||
$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
|
||||
|
||||
// run cron jobs
|
||||
$this->_do_cron();
|
||||
|
||||
// our action should have been called once with the correct args
|
||||
$this->assertEquals( 1, $a->get_call_count() );
|
||||
$this->assertEquals( array($args), $a->get_args() );
|
||||
|
||||
// it shouldn't appear in the schedule anymore
|
||||
$this->assertFalse( wp_next_scheduled($hook, $args) );
|
||||
|
||||
}
|
||||
|
||||
function test_run_schedule_recurring() {
|
||||
// schedule a recurring event, run it, and make sure the hook is called
|
||||
$hook = __FUNCTION__;
|
||||
$args = array(rand_str());
|
||||
$timestamp = strtotime('-1 second');
|
||||
$recur = 'hourly';
|
||||
|
||||
// register a test action
|
||||
$a = new MockAction();
|
||||
add_action($hook, array(&$a, 'action'));
|
||||
|
||||
// schedule an event for 1 second ago
|
||||
wp_schedule_event( $timestamp, $recur, $hook, $args );
|
||||
$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
|
||||
$this->assertEquals( $recur, wp_get_schedule($hook, $args) );
|
||||
|
||||
// run cron jobs
|
||||
$this->_do_cron();
|
||||
|
||||
// our action should have been called once with the correct args
|
||||
$this->assertEquals( 1, $a->get_call_count() );
|
||||
$this->assertEquals( array($args), $a->get_args() );
|
||||
|
||||
// it should appear in the schedule to run again in an hour's time
|
||||
$this->assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user