diff --git tests/phpunit/tests/post/wpListPages.php tests/phpunit/tests/post/wpListPages.php
new file mode 100644
index 0000000..5f1feb7
-
|
+
|
|
| 1 | <?php |
| 2 | |
| 3 | class Tests_Post_ListPages extends WP_UnitTestCase { |
| 4 | |
| 5 | function setUp() { |
| 6 | parent::setUp(); |
| 7 | } |
| 8 | |
| 9 | function test_wp_list_pages_exclude_all_parents() { |
| 10 | |
| 11 | $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) ); |
| 12 | $page_1_child = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); |
| 13 | $page_2 = $this->factory->post->create( array( 'post_type' => 'page' ) ); |
| 14 | $page_2_child = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) ); |
| 15 | |
| 16 | // excluding the parents should cause wp_list_pages to return nothing |
| 17 | $pages = wp_list_pages( 'echo=0&exclude=' . implode( ',', array( $page_1, $page_2 ) ) ); |
| 18 | |
| 19 | $this->assertEmpty( $pages ); |
| 20 | |
| 21 | } |
| 22 | |
| 23 | function test_wp_list_pages_exclude_tree() { |
| 24 | |
| 25 | $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) ); |
| 26 | $page_1_child = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); |
| 27 | |
| 28 | // excluding the parent should cause wp_list_pages to return nothing |
| 29 | $pages = wp_list_pages( 'echo=0&exclude_tree=' . $page_1 ); |
| 30 | |
| 31 | $this->assertEmpty( $pages ); |
| 32 | |
| 33 | } |
| 34 | |
| 35 | } |