Make WordPress Core

Ticket #25750: 25750.1.test.diff

File 25750.1.test.diff, 895 bytes (added by atimmer, 11 years ago)
  • tests/phpunit/tests/post/getPages.php

     
    22
    33/**
    44 * @group post
     5 * @group get_pages
    56 */
    67
    78class Tests_Post_getPages extends WP_UnitTestCase {
     
    910                parent::setUp();
    1011        }
    1112
     13        function test_hierarchical() {
     14                $pages = $this->factory->post->create_many( 2, array( 'post_type' => 'page' ) );
     15
     16                // Make the first post a child of the second
     17                wp_update_post( array(
     18                        'ID'     => $pages[0],
     19                        'post_parent' => $pages[1],
     20                ) );
     21
     22                $got_pages = get_pages();
     23
     24                // Now the second post should be in front of the first
     25                $this->assertEquals( $pages[0], $got_pages[1]->ID );
     26                $this->assertEquals( $pages[1], $got_pages[0]->ID );
     27
     28        }
     29
    1230        /**
    1331         * @ticket 23167
    1432         */