0, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'exclude' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => '', 'walker' => '', 'include' => '', 'post_type' => 'page', 'post_status' => 'publish', ); */ function setUp() { parent::setUp(); global $wpdb; $wpdb->query( 'TRUNCATE ' . $wpdb->prefix . 'posts' ); $pages = array(); $this->factory->user->create(); $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 1' ) ); $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 2' ) ); $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 3', 'post_author' => '2' ) ); foreach ( $pages as $page ) { $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 1' ) ); $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 2' ) ); $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 3' ) ); } } function test_wp_list_pages_default() { $args = array( 'echo' => false ); $expected['default'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['default'], $actual ); } function test_wp_list_pages_depth() { $args = array( 'echo' => false, 'depth' => 1 ); $expected['depth'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['depth'], $actual ); } function test_wp_list_pages_show_date() { $args = array( 'echo' => false, 'depth' => 1, 'show_date' => true ); $expected['show_date'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['show_date'], $actual ); } function test_wp_list_pages_date_format() { $args = array( 'echo' => false, 'show_date' => true, 'date_format' => 'l, F j, Y' ); $expected['date_format'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['date_format'], $actual ); } function test_wp_list_pages_child_of() { $args = array( 'echo' => false, 'child_of' => 2 ); $expected['child_of'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['child_of'], $actual ); } function test_wp_list_pages_exclude() { $args = array( 'echo' => false, 'exclude' => '2, 2' ); $expected['exclude'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['exclude'], $actual ); } function test_wp_list_pages_title_li() { $args = array( 'echo' => false, 'depth' => 1, 'title_li' => 'PageTitle' ); $expected['title_li'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['title_li'], $actual ); } function test_wp_list_pages_echo() { $args = array( 'echo' => true, 'depth' => 1 ); $expected['echo'] = ''; ob_start(); wp_list_pages( $args ); $actual = ob_get_clean(); $this->AssertEquals( $expected['echo'], $actual ); } function test_wp_list_pages_authors() { $args = array( 'echo' => false, 'authors' => '2', ); $expected['authors'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['authors'], $actual ); } function test_wp_list_pages_number() { $args = array( 'echo' => false, 'number' => 1, ); $expected['number'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['number'], $actual ); } function test_wp_list_pages_sort_column() { $args = array( 'echo' => false, 'sort_column' => 'post_author', 'sort_order' => 'DESC' ); $expected['sort_column'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['sort_column'], $actual ); } function test_wp_list_pages_link_before() { $args = array( 'echo' => false, 'link_before' => 'BEFORE' ); $expected['link_before'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['link_before'], $actual ); } function test_wp_list_pages_link_after() { $args = array( 'echo' => false, 'link_after' => 'AFTER' ); $expected['link_after'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['link_after'], $actual ); } function test_wp_list_pages_include() { $args = array( 'echo' => false, 'include' => '1,3' ); $expected['include'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['include'], $actual ); } function test_wp_list_pages_exclude_tree() { $args = array( 'echo' => false, 'exclude_tree' => '2, 3' ); $expected['exclude'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['exclude'], $actual ); } /** * @ticket 27326 */ function test_wp_list_page_combo_exclude_depth() { $args = array( 'echo' => false, 'exclude' => '3', 'depth' => 3 ); $expected['exclude_depth'] = ''; $actual = wp_list_pages( $args ); $this->AssertEquals( $expected['exclude_depth'], $actual ); } }