Changeset 993 in tests
- Timestamp:
- 08/28/2012 07:09:05 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/tests/post/objects.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/post/objects.php
r988 r993 89 89 } 90 90 91 function test_get_post_category_property() { 92 $post_id = $this->factory->post->create(); 93 $post = get_post( $post_id ); 94 95 $this->assertInternalType( 'array', $post->post_category ); 96 $this->assertEquals( 1, count( $post->post_category ) ); 97 $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] ); 98 $term1 = wp_insert_term( 'Foo', 'category' ); 99 $term2 = wp_insert_term( 'Bar', 'category' ); 100 $term3 = wp_insert_term( 'Baz', 'category' ); 101 wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'], $term3['term_id'] ) ); 102 $this->assertEquals( 3, count( $post->post_category ) ); 103 $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post->post_category ); 104 105 $post = get_post( $post_id, ARRAY_A ); 106 $this->assertEquals( 3, count( $post['post_category'] ) ); 107 $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post['post_category'] ); 108 } 109 110 function test_get_tags_input_property() { 111 $post_id = $this->factory->post->create(); 112 $post = get_post( $post_id ); 113 114 $this->assertInternalType( 'array', $post->tags_input ); 115 $this->assertEmpty( $post->tags_input ); 116 wp_set_post_tags( $post_id, 'Foo, Bar, Baz' ); 117 $this->assertInternalType( 'array', $post->tags_input ); 118 $this->assertEquals( 3, count( $post->tags_input ) ); 119 $this->assertEquals( array( 'Bar', 'Baz', 'Foo' ), $post->tags_input ); 120 121 $post = get_post( $post_id, ARRAY_A ); 122 $this->assertInternalType( 'array', $post['tags_input'] ); 123 $this->assertEquals( 3, count( $post['tags_input'] ) ); 124 $this->assertEquals( array( 'Bar', 'Baz', 'Foo' ), $post['tags_input'] ); 125 } 126 91 127 function test_get_post_filter() { 92 128 $post = get_post( $this->factory->post->create( array(
Note: See TracChangeset
for help on using the changeset viewer.