Changeset 25975 for trunk/tests/phpunit/tests/post/getPages.php
- Timestamp:
- 10/29/2013 01:47:48 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/getPages.php
r25972 r25975 182 182 $this->assertEqualSets( $child_ids, $post_ids ); 183 183 } 184 185 /** 186 * @ticket 25750 187 */ 188 function test_get_pages_hierarchical_and_no_parent() { 189 global $wpdb; 190 $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) ); 191 $page_2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 192 $page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 193 $page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) ); 194 195 $pages = get_pages(); // Defaults: hierarchical = true, parent = -1 196 $pages_default_args = get_pages( array( 'hierarchical' => true, 'parent' => -1 ) ); 197 // Confirm the defaults. 198 $this->assertEquals( $pages, $pages_default_args ); 199 200 /* 201 * Here's the tree we are testing: 202 * 203 * page 1 204 * - page 2 205 * -- page 4 206 * - page 3 207 * 208 * If hierarchical => true works, the order will be 1,2,4,3. 209 * If it doesn't, they will be in the creation order, 1,2,3,4. 210 */ 211 212 $this->assertEqualSets( array( $page_1, $page_2, $page_4, $page_3 ), wp_list_pluck( $pages, 'ID' ) ); 213 } 184 214 }
Note: See TracChangeset
for help on using the changeset viewer.