Move the unit test added in [25974] to the more appropriate file. see #25750.
git-svn-id: https://develop.svn.wordpress.org/trunk@25975 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2cac0fde8a
commit
9b9311ae2b
@ -829,34 +829,4 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$counts->publish = 7;
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 25750
|
||||
*/
|
||||
function test_get_pages_hierarchical_and_no_parent() {
|
||||
global $wpdb;
|
||||
$page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
|
||||
$page_2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
|
||||
$page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
|
||||
$page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) );
|
||||
|
||||
$pages = get_pages(); // Defaults: hierarchical = true, parent = -1
|
||||
$pages_default_args = get_pages( array( 'hierarchical' => true, 'parent' => -1 ) );
|
||||
// Confirm the defaults.
|
||||
$this->assertEquals( $pages, $pages_default_args );
|
||||
|
||||
/*
|
||||
* Here's the tree we are testing:
|
||||
*
|
||||
* page 1
|
||||
* - page 2
|
||||
* -- page 4
|
||||
* - page 3
|
||||
*
|
||||
* If hierarchical => true works, the order will be 1,2,4,3.
|
||||
* If it doesn't, they will be in the creation order, 1,2,3,4.
|
||||
*/
|
||||
|
||||
$this->assertEqualSets( array( $page_1, $page_2, $page_4, $page_3 ), wp_list_pluck( $pages, 'ID' ) );
|
||||
}
|
||||
}
|
||||
|
@ -181,4 +181,34 @@ class Tests_Post_getPages extends WP_UnitTestCase {
|
||||
$post_ids = get_children( array( 'fields' => 'ids', 'post_parent' => $post_id ) );
|
||||
$this->assertEqualSets( $child_ids, $post_ids );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 25750
|
||||
*/
|
||||
function test_get_pages_hierarchical_and_no_parent() {
|
||||
global $wpdb;
|
||||
$page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
|
||||
$page_2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
|
||||
$page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
|
||||
$page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) );
|
||||
|
||||
$pages = get_pages(); // Defaults: hierarchical = true, parent = -1
|
||||
$pages_default_args = get_pages( array( 'hierarchical' => true, 'parent' => -1 ) );
|
||||
// Confirm the defaults.
|
||||
$this->assertEquals( $pages, $pages_default_args );
|
||||
|
||||
/*
|
||||
* Here's the tree we are testing:
|
||||
*
|
||||
* page 1
|
||||
* - page 2
|
||||
* -- page 4
|
||||
* - page 3
|
||||
*
|
||||
* If hierarchical => true works, the order will be 1,2,4,3.
|
||||
* If it doesn't, they will be in the creation order, 1,2,3,4.
|
||||
*/
|
||||
|
||||
$this->assertEqualSets( array( $page_1, $page_2, $page_4, $page_3 ), wp_list_pluck( $pages, 'ID' ) );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user