Make WordPress Core


Ignore:
Timestamp:
10/28/2013 09:49:27 PM (13 years ago)
Author:
SergeyBiryukov
Message:

Move test_get_pages_include_exclude() and test_get_pages_parent() to tests/post/getPages.php. Add a @ticket reference. see [25168] and [25244].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post.php

    r25578 r25972  
    830830                return $counts;
    831831        }
    832 
    833         /**
    834          * @ticket 22074
    835          */
    836         function test_get_pages_include_exclude() {
    837                 $page_ids = array();
    838 
    839                 foreach ( range( 1, 20 ) as $i )
    840                         $page_ids[] = $this->factory->post->create( array( 'post_type' => 'page' ) );
    841 
    842                 $inc = array_slice( $page_ids, 0, 10 );
    843                 sort( $inc );
    844                 $exc = array_slice( $page_ids, 10 );
    845                 sort( $exc );
    846 
    847                 $include = get_pages( array( 'include' => $inc ) );
    848                 $inc_result = wp_list_pluck( $include, 'ID' );
    849                 sort( $inc_result );
    850                 $this->assertEquals( $inc, $inc_result );
    851 
    852                 $exclude = get_pages( array( 'exclude' => $exc ) );
    853                 $exc_result = wp_list_pluck( $exclude, 'ID' );
    854                 sort( $exc_result );
    855                 $this->assertEquals( $inc, $exc_result );
    856         }
    857 
    858         function test_get_pages_parent() {
    859                 $page_id1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    860                 $page_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
    861                 $page_id3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id2 ) );
    862                 $page_id4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
    863 
    864                 $pages = get_pages( array( 'parent' => 0, 'hierarchical' => false ) );
    865                 $this->assertEqualSets( array( $page_id1 ), wp_list_pluck( $pages, 'ID' ) );
    866 
    867                 $pages = get_pages( array( 'parent' => $page_id1, 'hierarchical' => false ) );
    868                 $this->assertEqualSets( array( $page_id2, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
    869 
    870                 $pages = get_pages( array( 'parent' => array( $page_id1, $page_id2 ), 'hierarchical' => false ) );
    871                 $this->assertEqualSets( array( $page_id2, $page_id3, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
    872 
    873                 $pages = get_pages( array( 'parent' => 0 ) );
    874                 $this->assertEqualSets( array( $page_id1 ), wp_list_pluck( $pages, 'ID' ) );
    875 
    876                 $pages = get_pages( array( 'parent' => $page_id1 ) );
    877                 $this->assertEqualSets( array( $page_id2, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
    878 
    879                 $pages = get_pages( array( 'parent' => array( $page_id1, $page_id2 ) ) );
    880                 $this->assertEqualSets( array( $page_id2, $page_id3, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
    881         }
    882832}
Note: See TracChangeset for help on using the changeset viewer.