Changeset 42343 for trunk/tests/phpunit/tests/post/objects.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/post/objects.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/objects.php
r38951 r42343 32 32 $post = get_post( $id, ARRAY_A ); 33 33 $this->assertInternalType( 'array', $post ); 34 $this->assertEquals( 'post', $post[ 'post_type'] );34 $this->assertEquals( 'post', $post['post_type'] ); 35 35 36 36 $post = get_post( $id, ARRAY_N ); 37 37 $this->assertInternalType( 'array', $post ); 38 $this->assertFalse( isset( $post[ 'post_type'] ) );38 $this->assertFalse( isset( $post['post_type'] ) ); 39 39 $this->assertTrue( in_array( 'post', $post ) ); 40 40 … … 42 42 $post = get_post( $post, ARRAY_A ); 43 43 $this->assertInternalType( 'array', $post ); 44 $this->assertEquals( 'post', $post[ 'post_type'] );45 $this->assertEquals( $id, $post[ 'ID'] );44 $this->assertEquals( 'post', $post['post_type'] ); 45 $this->assertEquals( $id, $post['ID'] ); 46 46 47 47 // Should default to OBJECT when given invalid output argument … … 53 53 $post_std = $post->to_array(); 54 54 $this->assertInternalType( 'array', $post_std ); 55 $post_std = (object) $post_std;55 $post_std = (object) $post_std; 56 56 $GLOBALS['post'] = $post_std; 57 $post = get_post( null );57 $post = get_post( null ); 58 58 $this->assertInstanceOf( 'WP_Post', $post ); 59 59 $this->assertEquals( $id, $post->ID ); … … 68 68 69 69 function test_get_post_ancestors() { 70 $parent_id = self::factory()->post->create();71 $child_id = self::factory()->post->create();70 $parent_id = self::factory()->post->create(); 71 $child_id = self::factory()->post->create(); 72 72 $grandchild_id = self::factory()->post->create(); 73 $updated = wp_update_post( array( 'ID' => $child_id, 'post_parent' => $parent_id ) ); 73 $updated = wp_update_post( 74 array( 75 'ID' => $child_id, 76 'post_parent' => $parent_id, 77 ) 78 ); 74 79 $this->assertEquals( $updated, $child_id ); 75 $updated = wp_update_post( array( 'ID' => $grandchild_id, 'post_parent' => $child_id ) ); 80 $updated = wp_update_post( 81 array( 82 'ID' => $grandchild_id, 83 'post_parent' => $child_id, 84 ) 85 ); 76 86 $this->assertEquals( $updated, $grandchild_id ); 77 87 … … 101 111 function test_get_post_category_property() { 102 112 $post_id = self::factory()->post->create(); 103 $post = get_post( $post_id );113 $post = get_post( $post_id ); 104 114 105 115 $this->assertInternalType( 'array', $post->post_category ); … … 111 121 wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'], $term3['term_id'] ) ); 112 122 $this->assertEquals( 3, count( $post->post_category ) ); 113 $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post->post_category );123 $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post->post_category ); 114 124 115 125 $post = get_post( $post_id, ARRAY_A ); 116 126 $this->assertEquals( 3, count( $post['post_category'] ) ); 117 $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post['post_category'] );127 $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post['post_category'] ); 118 128 } 119 129 120 130 function test_get_tags_input_property() { 121 131 $post_id = self::factory()->post->create(); 122 $post = get_post( $post_id );132 $post = get_post( $post_id ); 123 133 124 134 $this->assertInternalType( 'array', $post->tags_input ); … … 137 147 function test_get_page_template_property() { 138 148 $post_id = self::factory()->post->create(); 139 $post = get_post( $post_id );149 $post = get_post( $post_id ); 140 150 141 151 $this->assertInternalType( 'string', $post->page_template ); … … 150 160 151 161 function test_get_post_filter() { 152 $post = get_post( self::factory()->post->create( array( 153 'post_title' => "Mary's home" 154 ) ) ); 162 $post = get_post( 163 self::factory()->post->create( 164 array( 165 'post_title' => "Mary's home", 166 ) 167 ) 168 ); 155 169 156 170 $this->assertEquals( 'raw', $post->filter );
Note: See TracChangeset
for help on using the changeset viewer.