WordPress.org

Make WordPress Core

Changeset 1246 in tests


Ignore:
Timestamp:
03/18/13 14:28:37 (13 months ago)
Author:
ryan
Message:

Test invalid ID handling in wp_insert_post() and wp_update_post().

see #WP23474

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/post.php

    r1240 r1246  
    606606        $this->assertEquals( array( $parent_id ), get_post_ancestors( 0 ) ); 
    607607    } 
     608 
     609    /** 
     610     * @ticket 23474 
     611     */ 
     612    function test_update_invalid_post_id() { 
     613        $post_id = $this->factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) ); 
     614        $post = get_post( $post_id, ARRAY_A ); 
     615 
     616        $post['ID'] = 123456789; 
     617 
     618        $this->assertEquals( 0, wp_insert_post( $post ) ); 
     619        $this->assertEquals( 0, wp_update_post( $post ) ); 
     620 
     621        $this->assertInstanceOf( 'WP_Error', wp_insert_post( $post, true ) ); 
     622        $this->assertInstanceOf( 'WP_Error', wp_update_post( $post, true ) ); 
     623 
     624    } 
    608625} 
Note: See TracChangeset for help on using the changeset viewer.