Changeset 27767 for trunk/tests/phpunit/tests/post/getPages.php
- Timestamp:
- 03/27/2014 01:17:41 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/getPages.php
r27755 r27767 237 237 _unregister_post_type( $type ); 238 238 } 239 240 function test_exclude_tree() { 241 $post_id1 = $this->factory->post->create( array( 'post_type' => 'page' ) ); 242 $post_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id1 ) ); 243 $post_id3 = $this->factory->post->create( array( 'post_type' => 'page' ) ); 244 $post_id4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id3 ) ); 245 246 $all = get_pages(); 247 248 $this->assertCount( 4, $all ); 249 250 $exclude1 = get_pages( "exclude_tree=$post_id1" ); 251 $this->assertCount( 2, $exclude1 ); 252 253 $exclude2 = get_pages( array( 'exclude_tree' => $post_id1 ) ); 254 $this->assertCount( 2, $exclude2 ); 255 256 $exclude3 = get_pages( array( 'exclude_tree' => array( $post_id1 ) ) ); 257 $this->assertCount( 2, $exclude3 ); 258 259 $exclude4 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id2 ) ) ); 260 $this->assertCount( 2, $exclude4 ); 261 262 $exclude5 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id3 ) ) ); 263 $this->assertCount( 0, $exclude5 ); 264 265 $post_id5 = $this->factory->post->create( array( 'post_type' => 'page' ) ); 266 $post_id6 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id5 ) ); 267 268 $exclude6 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id3 ) ) ); 269 $this->assertCount( 2, $exclude6 ); 270 } 239 271 }
Note: See TracChangeset
for help on using the changeset viewer.