Changeset 407 in tests for wp-testcase/test_cron.php
- Timestamp:
- 08/04/2011 08:38:26 PM (15 years ago)
- File:
-
- 1 edited
-
wp-testcase/test_cron.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_cron.php
r366 r407 14 14 _set_cron_array(array()); 15 15 } 16 16 17 17 function test_wp_get_schedule_empty() { 18 18 // nothing scheduled … … 153 153 $multi_hook = rand_str(); 154 154 $multi_args = array(rand_str(), rand_str()); 155 155 156 156 // schedule several events with and without arguments 157 157 wp_schedule_single_event( strtotime('+1 hour'), $hook ); … … 161 161 wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args ); 162 162 wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args ); 163 163 164 164 // make sure they're returned by wp_next_scheduled() 165 165 $this->assertTrue( wp_next_scheduled($hook) > 0 ); … … 181 181 wp_clear_scheduled_hook($multi_hook, $multi_args); 182 182 $this->assertFalse( wp_next_scheduled($multi_hook, $multi_args) ); 183 183 184 184 } 185 185 … … 191 191 $ts1 = strtotime('+5 minutes'); 192 192 $ts2 = strtotime('+3 minutes'); 193 193 194 194 // first one works 195 195 wp_schedule_single_event( $ts1, $hook, $args ); 196 196 // second one is ignored 197 197 wp_schedule_single_event( $ts2, $hook, $args ); 198 198 199 199 // the next event should be at +5 minutes, not +3 200 200 $this->assertEquals( $ts1, wp_next_scheduled($hook, $args) ); … … 208 208 $ts1 = strtotime('+30 minutes'); 209 209 $ts2 = strtotime('+3 minutes'); 210 210 211 211 // first one works 212 212 wp_schedule_single_event( $ts1, $hook, $args ); 213 213 // second works too 214 214 wp_schedule_single_event( $ts2, $hook, $args ); 215 215 216 216 // the next event should be at +5 minutes, not +3 217 217 $this->assertEquals( $ts2, wp_next_scheduled($hook, $args) ); … … 225 225 * Disable the WP Cron running test for the moment as it kills the whole test suite. 226 226 * TODO - Fix it to work with the new cron implementation in trunk 227 * 227 * 228 228 class WPTestCronRunning extends _WPEmptyBlog { 229 229 function setUp() { … … 264 264 $this->assertEquals( 1, $a->get_call_count() ); 265 265 $this->assertEquals( array($args), $a->get_args() ); 266 266 267 267 // it shouldn't appear in the schedule anymore 268 268 $this->assertFalse( wp_next_scheduled($hook, $args) ); 269 269 270 270 } 271 271 272 272 function test_run_schedule_recurring() { 273 273 // schedule a recurring event, run it, and make sure the hook is called … … 292 292 $this->assertEquals( 1, $a->get_call_count() ); 293 293 $this->assertEquals( array($args), $a->get_args() ); 294 294 295 295 // it should appear in the schedule to run again in an hour's time 296 296 $this->assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)