Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (6 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r32354 r42343  
    2525        $this->pages = array(
    2626            0 => (object) array(
    27                 'ID' => 100,
     27                'ID'          => 100,
    2828                'post_parent' => 0,
    2929            ),
    3030            1 => (object) array(
    31                 'ID' => 101,
     31                'ID'          => 101,
    3232                'post_parent' => 100,
    3333            ),
    3434            2 => (object) array(
    35                 'ID' => 102,
     35                'ID'          => 102,
    3636                'post_parent' => 100,
    3737            ),
    3838            3 => (object) array(
    39                 'ID' => 103,
     39                'ID'          => 103,
    4040                'post_parent' => 101,
    4141            ),
     
    4343            // Not in the tree.
    4444            4 => (object) array(
    45                 'ID' => 104,
     45                'ID'          => 104,
    4646                'post_parent' => 9898989898,
    4747            ),
    4848
    4949            5 => (object) array(
    50                 'ID' => 105,
     50                'ID'          => 105,
    5151                'post_parent' => 100,
    5252            ),
    5353            6 => (object) array(
    54                 'ID' => 106,
     54                'ID'          => 106,
    5555                'post_parent' => 102,
    5656            ),
    5757            7 => (object) array(
    58                 'ID' => 107,
     58                'ID'          => 107,
    5959                'post_parent' => 106,
    6060            ),
    6161            8 => (object) array(
    62                 'ID' => 108,
     62                'ID'          => 108,
    6363                'post_parent' => 107,
    6464            ),
     
    6868    public function test_page_id_0_should_return_all_pages_in_tree_and_exclude_pages_not_in_tree() {
    6969        $expected = array( 100, 101, 102, 103, 105, 106, 107, 108 );
    70         $actual = get_page_children( 0, $this->pages );
     70        $actual   = get_page_children( 0, $this->pages );
    7171        $this->assertEqualSets( $expected, wp_list_pluck( $actual, 'ID' ) );
    7272    }
     
    7474    public function test_hierarchical_order_should_be_respected_in_results() {
    7575        $expected = array( 100, 101, 103, 102, 106, 107, 108, 105 );
    76         $actual = get_page_children( 0, $this->pages );
     76        $actual   = get_page_children( 0, $this->pages );
    7777        $this->assertEquals( $expected, wp_list_pluck( $actual, 'ID' ) );
    7878    }
     
    8080    public function test_not_all_pages_should_be_returned_when_page_id_is_in_the_middle_of_the_tree() {
    8181        $expected = array( 106, 107, 108 );
    82         $actual = get_page_children( 102, $this->pages );
     82        $actual   = get_page_children( 102, $this->pages );
    8383        $this->assertEquals( $expected, wp_list_pluck( $actual, 'ID' ) );
    8484    }
Note: See TracChangeset for help on using the changeset viewer.