Make WordPress Core

Changeset 407 in tests for wp-testcase/test_cron.php


Ignore:
Timestamp:
08/04/2011 08:38:26 PM (15 years ago)
Author:
ryan
Message:

Pinking shears

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_cron.php

    r366 r407  
    1414                _set_cron_array(array());
    1515        }
    16        
     16
    1717        function test_wp_get_schedule_empty() {
    1818                // nothing scheduled
     
    153153                $multi_hook = rand_str();
    154154                $multi_args = array(rand_str(), rand_str());
    155                
     155
    156156                // schedule several events with and without arguments
    157157                wp_schedule_single_event( strtotime('+1 hour'), $hook );
     
    161161                wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args );
    162162                wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args );
    163                
     163
    164164                // make sure they're returned by wp_next_scheduled()
    165165                $this->assertTrue( wp_next_scheduled($hook) > 0 );
     
    181181                wp_clear_scheduled_hook($multi_hook, $multi_args);
    182182                $this->assertFalse( wp_next_scheduled($multi_hook, $multi_args) );
    183                
     183
    184184        }
    185185
     
    191191                $ts1 = strtotime('+5 minutes');
    192192                $ts2 = strtotime('+3 minutes');
    193                
     193
    194194                // first one works
    195195                wp_schedule_single_event( $ts1, $hook, $args );
    196196                // second one is ignored
    197197                wp_schedule_single_event( $ts2, $hook, $args );
    198                
     198
    199199                // the next event should be at +5 minutes, not +3
    200200                $this->assertEquals( $ts1, wp_next_scheduled($hook, $args) );
     
    208208                $ts1 = strtotime('+30 minutes');
    209209                $ts2 = strtotime('+3 minutes');
    210                
     210
    211211                // first one works
    212212                wp_schedule_single_event( $ts1, $hook, $args );
    213213                // second works too
    214214                wp_schedule_single_event( $ts2, $hook, $args );
    215                
     215
    216216                // the next event should be at +5 minutes, not +3
    217217                $this->assertEquals( $ts2, wp_next_scheduled($hook, $args) );
     
    225225 * Disable the WP Cron running test for the moment as it kills the whole test suite.
    226226 * TODO - Fix it to work with the new cron implementation in trunk
    227  * 
     227 *
    228228class WPTestCronRunning extends _WPEmptyBlog {
    229229        function setUp() {
     
    264264                $this->assertEquals( 1, $a->get_call_count() );
    265265                $this->assertEquals( array($args), $a->get_args() );
    266                
     266
    267267                // it shouldn't appear in the schedule anymore
    268268                $this->assertFalse( wp_next_scheduled($hook, $args) );
    269269
    270270        }
    271        
     271
    272272        function test_run_schedule_recurring() {
    273273                // schedule a recurring event, run it, and make sure the hook is called
     
    292292                $this->assertEquals( 1, $a->get_call_count() );
    293293                $this->assertEquals( array($args), $a->get_args() );
    294                
     294
    295295                // it should appear in the schedule to run again in an hour's time
    296296                $this->assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
Note: See TracChangeset for help on using the changeset viewer.