WordPress.org

Make WordPress Core

Changeset 1224 in tests


Ignore:
Timestamp:
02/28/13 19:45:31 (2 years ago)
Author:
nacin
Message:

Change unit tests to reflect [23531]. see #22324.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/formatting/SanitizePost.php

    r1193 r1224  
    22/** 
    33 * @group formatting 
     4 * @group post 
    45 */ 
    56class Tests_Formatting_SanitizePost extends WP_UnitTestCase { 
    6  
    7     public function setUp() { 
    8         parent::setUp(); 
    9         $post_id = wp_insert_post( array( 
    10             'post_type' => 'post', 
    11             'post_status' => 'draft', 
    12             'post_content' => 'content', 
    13             'post_title' => 'title', 
    14         ) ); 
    15         $this->post = get_post( $post_id ); 
    16     } 
    177 
    188    /** 
     
    2010     */ 
    2111    function test_int_fields() { 
    22         $int_fields = array( 'ID', 'post_parent', 'menu_order', 'post_author', 'comment_count' ); 
    23         foreach ( $int_fields as $field ) 
    24             $this->post->{$field} = 'string'; 
     12        $post = $this->factory->post->create_and_get(); 
     13        $int_fields = array( 
     14            'ID'            => 'integer', 
     15            'post_parent'   => 'integer', 
     16            'menu_order'    => 'integer', 
     17            'post_author'   => 'string', 
     18            'comment_count' => 'string', 
     19        ); 
    2520 
    26         sanitize_post( $this->post ); 
    27  
    28         foreach ( $int_fields as $field ) 
    29             $this->assertTrue( is_int( $this->post->{$field} ), "Expected integer: {$field}" ); 
    30     } 
    31  
    32     public function tearDown() { 
    33         parent::tearDown(); 
    34         wp_delete_post( $this->post->ID, true ); 
     21        foreach ( $int_fields as $field => $type ) { 
     22            $this->assertInternalType( $type, $post->$field, "field $field" ); 
     23        } 
    3524    } 
    3625} 
Note: See TracChangeset for help on using the changeset viewer.