Make WordPress Core

Changeset 84 in tests


Ignore:
Timestamp:
11/17/2007 07:59:52 PM (17 years ago)
Author:
tellyworth
Message:

add test for wporg #5364

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_post.php

    r67 r84  
    121121        $this->assertEquals($future_date_2, $this->_next_schedule_for_post('publish_future_post', $id));
    122122    }
     123   
     124    function test_delete_future_post_cron() {
     125        // http://trac.wordpress.org/ticket/5364
     126        // "When I delete a future post using wp_delete_post($post->ID) it does not update the cron correctly."
     127       
     128        $future_date = strtotime('+1 day');
     129
     130        $post = array(
     131            'post_author' => $this->author->ID,
     132            'post_status' => 'publish',
     133            'post_content' => rand_str(),
     134            'post_title' => rand_str(),
     135            'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date),
     136        );
     137
     138        // insert a post and make sure the ID is ok
     139        $id = $this->post_ids[] = wp_insert_post($post);       
     140
     141        // check that there's a publish_future_post job scheduled at the right time
     142        $this->assertEquals($future_date, $this->_next_schedule_for_post('publish_future_post', $id));
     143
     144        // now delete the post and make sure the cron entry is removed
     145        wp_delete_post($id);
     146        $this->assertFalse($this->_next_schedule_for_post('publish_future_post', $id));
     147       
     148    }
    123149
    124150    function test_permlink_without_title() {
Note: See TracChangeset for help on using the changeset viewer.