WordPress.org

Make WordPress Core

Changeset 39554


Ignore:
Timestamp:
12/09/2016 11:11:28 PM (18 months ago)
Author:
johnbillion
Message:

Build/Test Tools: Remove commented out tests that have existed in an unimplemented state since the dawn of the test infrastructure.

See #38716

File:
1 edited

Legend:

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

    r38763 r39554  
    250250    }
    251251}
    252 
    253 /*
    254  * Disable the WP Cron running test for the moment as it kills the whole test suite.
    255  * TODO - Fix it to work with the new cron implementation in trunk
    256  *
    257 class WPTestCronRunning extends _WPEmptyBlog {
    258     function setUp() {
    259         parent::setUp();
    260         // make sure the schedule is clear
    261         _set_cron_array(array());
    262     }
    263 
    264     function tearDown() {
    265         parent::tearDown();
    266         // make sure the schedule is clear
    267         _set_cron_array(array());
    268     }
    269     function _do_cron() {
    270         // FIXME: wp-cron.php is difficult to test, could be wrapped in a function
    271         $_GET['check'] = wp_hash('187425');
    272         require(ABSPATH.'/wp-cron.php');
    273     }
    274 
    275     function test_run_schedule_single() {
    276         // schedule an event, run it, and make sure the hook is called
    277         $hook = __FUNCTION__;
    278         $args = array(rand_str());
    279         $timestamp = strtotime('-1 second');
    280 
    281         // register a test action
    282         $a = new MockAction();
    283         add_action($hook, array(&$a, 'action'));
    284 
    285         // schedule an event for 1 second ago
    286         wp_schedule_single_event( $timestamp, $hook, $args );
    287         $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
    288 
    289         // run cron jobs
    290         $this->_do_cron();
    291 
    292         // our action should have been called once with the correct args
    293         $this->assertEquals( 1, $a->get_call_count() );
    294         $this->assertEquals( array($args), $a->get_args() );
    295 
    296         // it shouldn't appear in the schedule anymore
    297         $this->assertFalse( wp_next_scheduled($hook, $args) );
    298 
    299     }
    300 
    301     function test_run_schedule_recurring() {
    302         // schedule a recurring event, run it, and make sure the hook is called
    303         $hook = __FUNCTION__;
    304         $args = array(rand_str());
    305         $timestamp = strtotime('-1 second');
    306         $recur = 'hourly';
    307 
    308         // register a test action
    309         $a = new MockAction();
    310         add_action($hook, array(&$a, 'action'));
    311 
    312         // schedule an event for 1 second ago
    313         wp_schedule_event( $timestamp, $recur, $hook, $args );
    314         $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
    315         $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
    316 
    317         // run cron jobs
    318         $this->_do_cron();
    319 
    320         // our action should have been called once with the correct args
    321         $this->assertEquals( 1, $a->get_call_count() );
    322         $this->assertEquals( array($args), $a->get_args() );
    323 
    324         // it should appear in the schedule to run again in an hour's time
    325         $this->assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
    326 
    327     }
    328 }
    329 */
Note: See TracChangeset for help on using the changeset viewer.