Changeset 274 in tests for wp-testcase/test_cron.php
- Timestamp:
- 12/06/2009 04:07:49 PM (16 years ago)
- File:
-
- 1 edited
-
wp-testcase/test_cron.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_cron.php
r272 r274 119 119 wp_clear_scheduled_hook($hook, $args[0]); 120 120 $this->assertFalse( wp_next_scheduled($hook, $args) ); 121 } 122 123 function test_clear_schedule_multiple_args() { 124 $hook = rand_str(); 125 $args = array(rand_str(), rand_str()); 126 127 // schedule several events with and without arguments 128 wp_schedule_single_event( strtotime('+1 hour'), $hook ); 129 wp_schedule_single_event( strtotime('+2 hour'), $hook ); 130 wp_schedule_single_event( strtotime('+3 hour'), $hook, $args ); 131 wp_schedule_single_event( strtotime('+4 hour'), $hook, $args ); 132 133 // make sure they're returned by wp_next_scheduled() 134 $this->assertTrue( wp_next_scheduled($hook) > 0 ); 135 $this->assertTrue( wp_next_scheduled($hook, $args) > 0 ); 136 137 // clear the schedule for the no args events and make sure it's gone 138 wp_clear_scheduled_hook($hook); 139 $this->assertFalse( wp_next_scheduled($hook) ); 140 // the args events should still be there 141 $this->assertTrue( wp_next_scheduled($hook, $args) > 0 ); 142 143 // clear the schedule for the args events and make sure they're gone too 144 // note: wp_clear_scheduled_hook() expects args passed directly, rather than as an array 145 wp_clear_scheduled_hook($hook, $args[0], $args[1]); 146 $this->assertFalse( wp_next_scheduled($hook, $args) ); 147 } 148 149 function test_clear_schedule_new_args() { 150 $this->knownWPBug(10468); 151 $hook = rand_str(); 152 $args = array(rand_str()); 153 $multi_hook = rand_str(); 154 $multi_args = array(rand_str(), rand_str()); 155 156 // schedule several events with and without arguments 157 wp_schedule_single_event( strtotime('+1 hour'), $hook ); 158 wp_schedule_single_event( strtotime('+2 hour'), $hook ); 159 wp_schedule_single_event( strtotime('+3 hour'), $hook, $args ); 160 wp_schedule_single_event( strtotime('+4 hour'), $hook, $args ); 161 wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args ); 162 wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args ); 163 164 // make sure they're returned by wp_next_scheduled() 165 $this->assertTrue( wp_next_scheduled($hook) > 0 ); 166 $this->assertTrue( wp_next_scheduled($hook, $args) > 0 ); 167 168 // clear the schedule for the no args events and make sure it's gone 169 wp_clear_scheduled_hook($hook); 170 $this->assertFalse( wp_next_scheduled($hook) ); 171 // the args events should still be there 172 $this->assertTrue( wp_next_scheduled($hook, $args) > 0 ); 173 174 // clear the schedule for the args events and make sure they're gone too 175 // wp_clear_scheduled_hook() should take args as an array like the other functions. 176 wp_clear_scheduled_hook($hook, $args); 177 $this->assertFalse( wp_next_scheduled($hook, $args) ); 178 179 // clear the schedule for the args events and make sure they're gone too 180 // wp_clear_scheduled_hook() should take args as an array like the other functions. 181 wp_clear_scheduled_hook($multi_hook, $multi_args); 182 $this->assertFalse( wp_next_scheduled($multi_hook, $multi_args) ); 183 121 184 } 122 185
Note: See TracChangeset
for help on using the changeset viewer.