Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 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/adminbar.php

    r40581 r42343  
    5454        $admin_bar = new WP_Admin_Bar;
    5555
    56         $admin_bar->add_node( array(
    57             'id' => 'test-node',
    58             'meta' => array( 'class' => 'test-class' ),
    59         ) );
     56        $admin_bar->add_node(
     57            array(
     58                'id'   => 'test-node',
     59                'meta' => array( 'class' => 'test-class' ),
     60            )
     61        );
    6062
    6163        $node1 = $admin_bar->get_node( 'test-node' );
    6264        $this->assertEquals( array( 'class' => 'test-class' ), $node1->meta );
    6365
    64         $admin_bar->add_node( array(
    65             'id' => 'test-node',
    66             'meta' => array( 'some-meta' => 'value' ),
    67         ) );
     66        $admin_bar->add_node(
     67            array(
     68                'id'   => 'test-node',
     69                'meta' => array( 'some-meta' => 'value' ),
     70            )
     71        );
    6872
    6973        $node2 = $admin_bar->get_node( 'test-node' );
    70         $this->assertEquals( array( 'class' => 'test-class', 'some-meta' => 'value' ), $node2->meta );
     74        $this->assertEquals(
     75            array(
     76                'class'     => 'test-class',
     77                'some-meta' => 'value',
     78            ), $node2->meta
     79        );
    7180    }
    7281
     
    129138     */
    130139    public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_blog() {
    131         $blog_id = self::factory()->blog->create( array(
    132             'user_id' => self::$admin_id,
    133         ) );
     140        $blog_id = self::factory()->blog->create(
     141            array(
     142                'user_id' => self::$admin_id,
     143            )
     144        );
    134145
    135146        $this->assertTrue( user_can( self::$admin_id, 'read' ) );
     
    179190        $this->assertFalse( user_can( self::$no_role_id, 'read' ) );
    180191
    181         $blog_id = self::factory()->blog->create( array(
    182             'user_id' => self::$admin_id,
    183         ) );
     192        $blog_id = self::factory()->blog->create(
     193            array(
     194                'user_id' => self::$admin_id,
     195            )
     196        );
    184197
    185198        $this->assertTrue( is_user_member_of_blog( self::$admin_id, $blog_id ) );
     
    273286                // Empty string.
    274287                array(
    275                     'id' => 'test-node',
     288                    'id'   => 'test-node',
    276289                    'meta' => array( 'tabindex' => '' ),
    277290                ),
     
    336349
    337350        $post = array(
    338             'post_author' => self::$editor_id,
    339             'post_status' => 'publish',
     351            'post_author'  => self::$editor_id,
     352            'post_status'  => 'publish',
    340353            'post_content' => 'Post Content',
    341             'post_title' => 'Post Title',
    342         );
    343         $id = wp_insert_post( $post );
     354            'post_title'   => 'Post Title',
     355        );
     356        $id   = wp_insert_post( $post );
    344357
    345358        // Set queried object to the newly created post.
    346359        global $wp_the_query;
    347         $wp_the_query->queried_object = (object) array( 'ID' => $id, 'post_type' => 'post' );
     360        $wp_the_query->queried_object = (object) array(
     361            'ID'        => $id,
     362            'post_type' => 'post',
     363        );
    348364
    349365        $wp_admin_bar = $this->get_standard_admin_bar();
     
    361377        // Set queried object to a non-existing post.
    362378        global $wp_the_query;
    363         $wp_the_query->queried_object = (object) array( 'ID' => 0, 'post_type' => 'post' );
     379        $wp_the_query->queried_object = (object) array(
     380            'ID'        => 0,
     381            'post_type' => 'post',
     382        );
    364383
    365384        $wp_admin_bar = $this->get_standard_admin_bar();
     
    472491     */
    473492    public function test_admin_bar_has_no_archives_link_for_non_public_cpt() {
    474         register_post_type( 'foo-non-public', array(
    475             'public'            => false,
    476             'has_archive'       => true,
    477             'show_in_admin_bar' => true,
    478         ) );
     493        register_post_type(
     494            'foo-non-public', array(
     495                'public'            => false,
     496                'has_archive'       => true,
     497                'show_in_admin_bar' => true,
     498            )
     499        );
    479500
    480501        set_current_screen( 'edit-foo-non-public' );
     
    493514     */
    494515    public function test_admin_bar_has_no_archives_link_for_cpt_without_archive() {
    495         register_post_type( 'foo-non-public', array(
    496             'public'            => true,
    497             'has_archive'       => false,
    498             'show_in_admin_bar' => true,
    499         ) );
     516        register_post_type(
     517            'foo-non-public', array(
     518                'public'            => true,
     519                'has_archive'       => false,
     520                'show_in_admin_bar' => true,
     521            )
     522        );
    500523
    501524        set_current_screen( 'edit-foo-non-public' );
     
    514537     */
    515538    public function test_admin_bar_has_no_archives_link_for_cpt_not_shown_in_admin_bar() {
    516         register_post_type( 'foo-non-public', array(
    517             'public'            => true,
    518             'has_archive'       => true,
    519             'show_in_admin_bar' => false,
    520         ) );
     539        register_post_type(
     540            'foo-non-public', array(
     541                'public'            => true,
     542                'has_archive'       => true,
     543                'show_in_admin_bar' => false,
     544            )
     545        );
    521546
    522547        set_current_screen( 'edit-foo-non-public' );
     
    634659        wp_set_current_user( self::$admin_id );
    635660
    636         $this->factory()->post->create( array(
    637             'post_type' => 'customize_changeset',
    638             'post_status' => 'auto-draft',
    639             'post_name' => $uuid,
    640         ) );
    641         $wp_customize = new WP_Customize_Manager( array(
    642             'changeset_uuid' => $uuid,
    643         ) );
     661        $this->factory()->post->create(
     662            array(
     663                'post_type'   => 'customize_changeset',
     664                'post_status' => 'auto-draft',
     665                'post_name'   => $uuid,
     666            )
     667        );
     668        $wp_customize = new WP_Customize_Manager(
     669            array(
     670                'changeset_uuid' => $uuid,
     671            )
     672        );
    644673        $wp_customize->start_previewing_theme();
    645674
    646675        set_current_screen( 'front' );
    647676        $wp_admin_bar = $this->get_standard_admin_bar();
    648         $node = $wp_admin_bar->get_node( 'customize' );
     677        $node         = $wp_admin_bar->get_node( 'customize' );
    649678        $this->assertNotEmpty( $node );
    650679
    651         $parsed_url = wp_parse_url( $node->href );
     680        $parsed_url   = wp_parse_url( $node->href );
    652681        $query_params = array();
    653682        wp_parse_str( $parsed_url['query'], $query_params );
Note: See TracChangeset for help on using the changeset viewer.