Changeset 1224 in tests
- Timestamp:
- 02/28/2013 07:45:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/formatting/SanitizePost.php
r1193 r1224 2 2 /** 3 3 * @group formatting 4 * @group post 4 5 */ 5 6 class 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 }17 7 18 8 /** … … 20 10 */ 21 11 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 ); 25 20 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 } 35 24 } 36 25 }
Note: See TracChangeset
for help on using the changeset viewer.