| | 127 | function test_unschedule_hook() { |
| | 128 | $hook = rand_str(); |
| | 129 | $args = array(rand_str()); |
| | 130 | |
| | 131 | // schedule several events with and without arguments |
| | 132 | wp_schedule_single_event( strtotime('+1 hour'), $hook ); |
| | 133 | wp_schedule_single_event( strtotime('+2 hour'), $hook ); |
| | 134 | wp_schedule_single_event( strtotime('+3 hour'), $hook, $args ); |
| | 135 | wp_schedule_single_event( strtotime('+4 hour'), $hook, $args ); |
| | 136 | |
| | 137 | // make sure they're returned by wp_next_scheduled() |
| | 138 | $this->assertTrue( wp_next_scheduled($hook) > 0 ); |
| | 139 | $this->assertTrue( wp_next_scheduled($hook, $args) > 0 ); |
| | 140 | |
| | 141 | // clear the schedule for the no args events and make sure it's gone |
| | 142 | wp_unschedule_hook($hook); |
| | 143 | $this->assertFalse( wp_next_scheduled($hook) ); |
| | 144 | } |
| | 145 | |